Commit f6c1630c authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade excepción para modificación sin privilegios

Se lanza excepción si se intenta modificar una configuración de la cual
no es propietario
parent aceb8f2e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -140,7 +140,8 @@ public enum ExceptionType implements ExceptionTypeItfc {
	
	SELECTION_CHANGE_NOT_ALLOWED(Constants.SELECTION_CHANGE_NOT_ALLOWED),
	SETTINGS_TO_CLONE_NOT_FOUND_EXCEPTION(Constants.SETTINGS_TO_CLONE_NOT_FOUND_EXCEPTION),
	SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION(Constants.SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION);
	SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION(Constants.SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION),
	SETTINGS_CHANGE_FORBIDDEN(Constants.SETTINGS_CHANGE_FORBIDDEN_EXCEPTION);
	
	// @formatter:on

@@ -285,7 +286,8 @@ public enum ExceptionType implements ExceptionTypeItfc {
			// Settings
			SELECTION_CHANGE_NOT_ALLOWED = "SelectionChangeNotAllowedException",
			SETTINGS_TO_CLONE_NOT_FOUND_EXCEPTION = "SettingsToCloneNotFoundException",
			SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION = "SettingsToSaveNotFoundException";
			SETTINGS_TO_SAVE_NOT_FOUND_EXCEPTION = "SettingsToSaveNotFoundException",
			SETTINGS_CHANGE_FORBIDDEN_EXCEPTION = "SettingsChangeForbiddenException";
		// @formatter:on
	}

+37 −0
Original line number Diff line number Diff line
package es.redmic.exception.common;

/*-
 * #%L
 * Exceptions
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

public abstract class RequestForbiddenException extends BaseException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public RequestForbiddenException(ExceptionTypeItfc code) {
		this(code, null);
	}

	public RequestForbiddenException(ExceptionTypeItfc code, Exception e) {
		super(code, e);
	}
}
+36 −0
Original line number Diff line number Diff line
package es.redmic.exception.settings;

import es.redmic.exception.common.ExceptionType;
import es.redmic.exception.common.RequestForbiddenException;

/*-
 * #%L
 * Exceptions
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

public class SettingsChangeForbiddenException extends RequestForbiddenException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public SettingsChangeForbiddenException() {
		super(ExceptionType.SETTINGS_CHANGE_FORBIDDEN);
	}
}
+1 −0
Original line number Diff line number Diff line
@@ -114,3 +114,4 @@ ReportError=Error. Required report could not be generated. Type {0}. Ids {1}.
SelectionChangeNotAllowedException=Error. Selection could not be changed. Try again.
SettingsToCloneNotFoundException=Error. It is not possible to retrieve the configuration. It may not exist or be accessible.
SettingsToSaveNotFoundException=Error. It is not possible to save your settings. It may not be accessible.
SettingsChangeForbiddenException=Error. You cannot change the configuration because you do not have sufficient privileges.
+1 −0
Original line number Diff line number Diff line
@@ -114,3 +114,4 @@ ReportError=Error. No se ha podido generar el report requerido. Tipo {0}. Ids {1
SelectionChangeNotAllowedException=Error. No se ha podido cambiar la selección. Inténtelo de nuevo.
SettingsToCloneNotFoundException=Error. No es posible recuperar la configuración especificada. Es posible que no exista o no esté accesible.
SettingsToSaveNotFoundException=Error. No es posible guardar su configuración. Es posible que no esté accesible.
SettingsChangeForbiddenException=Error. No es posible cambiar la configuración debido a que no tiene privilegios suficientes.