Skip to content

Commit

Permalink
chore(batch): adjust documentation about AuthorizationException
Browse files Browse the repository at this point in the history
related to CAM-8546
  • Loading branch information
romansmirnov committed Dec 7, 2017
1 parent 36820c8 commit 452c592
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,8 @@ public interface ExternalTaskService {
* @param externalTaskQuery a query which selects the external tasks to set the retries for.
* @throws NotFoundException if no external task with one of the given id exists
* @throws BadUserRequestException if the ids are null or the number of retries is negative
* @throws AuthorizationException thrown if the current user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}
* or does not possess any of the following permissions:
* <ul>
* <li>{@link Permissions#UPDATE} on {@link Resources#PROCESS_INSTANCE}</li>
* <li>{@link Permissions#UPDATE_INSTANCE} on {@link Resources#PROCESS_DEFINITION}</li>
* </ul>
* @throws AuthorizationException
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
public Batch setRetriesAsync(List<String> externalTaskIds, ExternalTaskQuery externalTaskQuery, int retries);

Expand Down
18 changes: 6 additions & 12 deletions engine/src/main/java/org/camunda/bpm/engine/HistoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no process instances is found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricProcessInstancesAsync(List<String> processInstanceIds, String deleteReason);

Expand All @@ -221,8 +220,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no process instances is found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricProcessInstancesAsync(HistoricProcessInstanceQuery query, String deleteReason);

Expand All @@ -234,8 +232,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no process instances is found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricProcessInstancesAsync(List<String> processInstanceIds, HistoricProcessInstanceQuery query, String deleteReason);

Expand Down Expand Up @@ -319,8 +316,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no decision instances are found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#DECISION_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricDecisionInstancesAsync(List<String> decisionInstanceIds, String deleteReason);

Expand All @@ -330,8 +326,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no decision instances are found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#DECISION_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricDecisionInstancesAsync(HistoricDecisionInstanceQuery query, String deleteReason);

Expand All @@ -342,8 +337,7 @@ public interface HistoryService {
* @throws BadUserRequestException
* when no decision instances are found with the given ids or ids are null.
* @throws AuthorizationException
* If the user has no {@link Permissions#DELETE_HISTORY} permission on {@link Resources#DECISION_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteHistoricDecisionInstancesAsync(List<String> decisionInstanceIds, HistoricDecisionInstanceQuery query, String deleteReason);

Expand Down
16 changes: 4 additions & 12 deletions engine/src/main/java/org/camunda/bpm/engine/ManagementService.java
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,7 @@ public interface ManagementService {
*
* @throws BadUserRequestException if jobIds is null
* @throws AuthorizationException
* If the user has no {@link Permissions#UPDATE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#UPDATE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION},
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch setJobRetriesAsync(List<String> jobIds, int retries);

Expand All @@ -855,9 +853,7 @@ public interface ManagementService {
*
* @throws BadUserRequestException if jobQuery is null
* @throws AuthorizationException
* If the user has no {@link Permissions#UPDATE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#UPDATE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION},
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch setJobRetriesAsync(JobQuery jobQuery, int retries);

Expand All @@ -877,9 +873,7 @@ public interface ManagementService {
*
* @throws BadUserRequestException if neither jobIds, nor jobQuery is provided or result in empty list
* @throws AuthorizationException
* If the user has no {@link Permissions#UPDATE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#UPDATE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION},
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch setJobRetriesAsync(List<String> jobIds, JobQuery jobQuery, int retries);

Expand All @@ -898,9 +892,7 @@ public interface ManagementService {
* @param retries number of retries.
*
* @throws AuthorizationException
* If the user has no {@link Permissions#UPDATE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#UPDATE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION},
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch setJobRetriesAsync (List<String> processInstanceIds, ProcessInstanceQuery query, int retries);

Expand Down
20 changes: 5 additions & 15 deletions engine/src/main/java/org/camunda/bpm/engine/RuntimeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,7 @@ public interface RuntimeService {
* @throws BadUserRequestException
* when no process instance is found with the given id or id is null.
* @throws AuthorizationException
* if the user has no {@link Permissions#DELETE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#DELETE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteProcessInstancesAsync(List<String> processInstanceIds, ProcessInstanceQuery processInstanceQuery, String deleteReason);

Expand All @@ -619,9 +617,7 @@ public interface RuntimeService {
* @throws BadUserRequestException
* when no process instance is found with the given id or id is null.
* @throws AuthorizationException
* if the user has no {@link Permissions#DELETE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#DELETE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteProcessInstancesAsync(List<String> processInstanceIds, ProcessInstanceQuery processInstanceQuery, String deleteReason, boolean skipCustomListeners);

Expand All @@ -640,9 +636,7 @@ public interface RuntimeService {
* @throws BadUserRequestException
* when no process instance is found with the given id or id is null.
* @throws AuthorizationException
* if the user has no {@link Permissions#DELETE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#DELETE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteProcessInstancesAsync(List<String> processInstanceIds, ProcessInstanceQuery processInstanceQuery, String deleteReason, boolean skipCustomListeners, boolean skipSubprocesses);

Expand All @@ -658,9 +652,7 @@ public interface RuntimeService {
* @throws BadUserRequestException
* when no process instance is found with the given id or id is null.
* @throws AuthorizationException
* if the user has no {@link Permissions#DELETE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#DELETE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteProcessInstancesAsync(ProcessInstanceQuery processInstanceQuery, String deleteReason);

Expand All @@ -678,9 +670,7 @@ public interface RuntimeService {
* @throws BadUserRequestException
* when no process instance is found with the given id or id is null.
* @throws AuthorizationException
* if the user has no {@link Permissions#DELETE} permission on {@link Resources#PROCESS_INSTANCE}
* or no {@link Permissions#DELETE_INSTANCE} permission on {@link Resources#PROCESS_DEFINITION}
* or no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
* If the user has no {@link Permissions#CREATE} permission on {@link Resources#BATCH}.
*/
Batch deleteProcessInstancesAsync(List<String> processInstanceIds, String deleteReason);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.camunda.bpm.engine.authorization.Permissions;
import org.camunda.bpm.engine.authorization.Resources;
import org.camunda.bpm.engine.batch.Batch;
import org.camunda.bpm.engine.exception.NullValueException;
import org.camunda.bpm.engine.impl.ProcessEngineLogger;
import org.camunda.bpm.engine.impl.RestartProcessInstanceBuilderImpl;
import org.camunda.bpm.engine.impl.RestartProcessInstancesBatchConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,4 @@ protected BatchJobHandler<BatchConfiguration> getBatchJobHandler(ProcessEngineCo
return (BatchJobHandler<BatchConfiguration>) processEngineConfiguration.getBatchHandlers().get(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION);
}

protected void checkAuthorizations(CommandContext commandContext) {
super.checkAuthorizations(commandContext);
commandContext.getAuthorizationManager().checkAuthorization(Permissions.DELETE_HISTORY, Resources.DECISION_DEFINITION);
}

}

0 comments on commit 452c592

Please sign in to comment.