public static void ensureValidIndividualResourceId(String message, String id) { ensureValidIndividualResourceId(ProcessEngineException.class, message, id); }
public void setAuthentication(Authentication auth) { if(auth == null) { clearAuthentication(); } else { if (auth.getUserId() != null) { EnsureUtil.ensureValidIndividualResourceId("Invalid user id provided", auth.getUserId()); } if (auth.getGroupIds() != null) { EnsureUtil.ensureValidIndividualResourceIds("At least one invalid group id provided", auth.getGroupIds()); } if (auth.getTenantIds() != null) { EnsureUtil.ensureValidIndividualResourceIds("At least one invalid tenant id provided", auth.getTenantIds()); } currentAuthentication.set(auth); } }
public static void ensureValidIndividualResourceId(String message, String id) { ensureValidIndividualResourceId(ProcessEngineException.class, message, id); }
public void setAuthentication(Authentication auth) { if(auth == null) { clearAuthentication(); } else { if (auth.getUserId() != null) { EnsureUtil.ensureValidIndividualResourceId("Invalid user id provided", auth.getUserId()); } if (auth.getGroupIds() != null) { EnsureUtil.ensureValidIndividualResourceIds("At least one invalid group id provided", auth.getGroupIds()); } if (auth.getTenantIds() != null) { EnsureUtil.ensureValidIndividualResourceIds("At least one invalid tenant id provided", auth.getTenantIds()); } currentAuthentication.set(auth); } }
public static void ensureValidIndividualResourceIds(Class<? extends ProcessEngineException> exceptionClass, String message, Collection<String> ids) { ensureNotNull(exceptionClass, message, "id", ids); for (String id : ids) { ensureValidIndividualResourceId(exceptionClass, message, id); } }
public static void ensureValidIndividualResourceIds(Class<? extends ProcessEngineException> exceptionClass, String message, Collection<String> ids) { ensureNotNull(exceptionClass, message, "id", ids); for (String id : ids) { ensureValidIndividualResourceId(exceptionClass, message, id); } }
protected void validateId(DbEntity dbEntity) { EnsureUtil.ensureValidIndividualResourceId("Entity " + dbEntity + " has an invalid id", dbEntity.getId()); }
protected void validateId(DbEntity dbEntity) { EnsureUtil.ensureValidIndividualResourceId("Entity " + dbEntity + " has an invalid id", dbEntity.getId()); }
public AuthorizationEntity[] newGroup(Group group) { List<AuthorizationEntity> authorizations = new ArrayList<AuthorizationEntity>(); // whenever a new group is created, all users part of the // group are granted READ permissions on the group String groupId = group.getId(); ensureValidIndividualResourceId("Cannot create default authorization for group " + groupId, groupId); AuthorizationEntity groupMemberAuthorization = createGrantAuthorization(null, groupId, GROUP, groupId, READ); authorizations.add(groupMemberAuthorization); return authorizations.toArray(new AuthorizationEntity[0]); }
public AuthorizationEntity[] newGroup(Group group) { List<AuthorizationEntity> authorizations = new ArrayList<AuthorizationEntity>(); // whenever a new group is created, all users part of the // group are granted READ permissions on the group String groupId = group.getId(); ensureValidIndividualResourceId("Cannot create default authorization for group " + groupId, groupId); AuthorizationEntity groupMemberAuthorization = createGrantAuthorization(null, groupId, GROUP, groupId, READ); authorizations.add(groupMemberAuthorization); return authorizations.toArray(new AuthorizationEntity[0]); }
public AuthorizationEntity[] newUser(User user) { // create an authorization which gives the user all permissions on himself: String userId = user.getId(); ensureValidIndividualResourceId("Cannot create default authorization for user " + userId, userId); AuthorizationEntity resourceOwnerAuthorization = createGrantAuthorization(userId, null, USER, userId, ALL); return new AuthorizationEntity[]{ resourceOwnerAuthorization }; }
public AuthorizationEntity[] newUser(User user) { // create an authorization which gives the user all permissions on himself: String userId = user.getId(); ensureValidIndividualResourceId("Cannot create default authorization for user " + userId, userId); AuthorizationEntity resourceOwnerAuthorization = createGrantAuthorization(userId, null, USER, userId, ALL); return new AuthorizationEntity[]{ resourceOwnerAuthorization }; }
public AuthorizationEntity[] newFilter(Filter filter) { String owner = filter.getOwner(); if(owner != null) { // create an authorization which gives the owner of the filter all permissions on the filter String filterId = filter.getId(); ensureValidIndividualResourceId("Cannot create default authorization for filter owner " + owner, owner); AuthorizationEntity filterOwnerAuthorization = createGrantAuthorization(owner, null, FILTER, filterId, ALL); return new AuthorizationEntity[]{ filterOwnerAuthorization }; } else { return null; } }
public AuthorizationEntity[] newFilter(Filter filter) { String owner = filter.getOwner(); if(owner != null) { // create an authorization which gives the owner of the filter all permissions on the filter String filterId = filter.getId(); ensureValidIndividualResourceId("Cannot create default authorization for filter owner " + owner, owner); AuthorizationEntity filterOwnerAuthorization = createGrantAuthorization(owner, null, FILTER, filterId, ALL); return new AuthorizationEntity[]{ filterOwnerAuthorization }; } else { return null; } }
public AuthorizationEntity[] newTaskUserIdentityLink(Task task, String userId, String type) { // create (or update) an authorization for the given user // whenever a new user identity link will be added ensureValidIndividualResourceId("Cannot grant default authorization for identity link to user " + userId, userId); String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByUserId(userId, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and (UPDATE or TASK_WORK) permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, userId, null, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; }
public AuthorizationEntity[] newTaskGroupIdentityLink(Task task, String groupId, String type) { ensureValidIndividualResourceId("Cannot grant default authorization for identity link to group " + groupId, groupId); // create (or update) an authorization for the given group // whenever a new user identity link will be added String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByGroupId(groupId, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and UPDATE permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, null, groupId, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; }
public AuthorizationEntity[] newTaskUserIdentityLink(Task task, String userId, String type) { // create (or update) an authorization for the given user // whenever a new user identity link will be added ensureValidIndividualResourceId("Cannot grant default authorization for identity link to user " + userId, userId); String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByUserId(userId, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and (UPDATE or TASK_WORK) permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, userId, null, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; }
public AuthorizationEntity[] newTaskGroupIdentityLink(Task task, String groupId, String type) { ensureValidIndividualResourceId("Cannot grant default authorization for identity link to group " + groupId, groupId); // create (or update) an authorization for the given group // whenever a new user identity link will be added String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByGroupId(groupId, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and UPDATE permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, null, groupId, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; }
public AuthorizationEntity[] newTaskAssignee(Task task, String oldAssignee, String newAssignee) { if (newAssignee != null) { ensureValidIndividualResourceId("Cannot create default authorization for assignee " + newAssignee, newAssignee); // create (or update) an authorization for the new assignee. String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByUserId(newAssignee, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and (UPDATE/TASK_WORK) permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, newAssignee, null, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; } return null; }
public AuthorizationEntity[] newTaskOwner(Task task, String oldOwner, String newOwner) { if (newOwner != null) { ensureValidIndividualResourceId("Cannot create default authorization for owner " + newOwner, newOwner); // create (or update) an authorization for the new owner. String taskId = task.getId(); // fetch existing authorization AuthorizationEntity authorization = getGrantAuthorizationByUserId(newOwner, TASK, taskId); // update authorization: // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission) // (2) fetched authorization != null -> add READ and (UPDATE/TASK_WORK) permission // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided authorization = updateAuthorization(authorization, newOwner, null, TASK, taskId, READ, getDefaultUserPermissionForTask()); // return always created or updated authorization return new AuthorizationEntity[]{ authorization }; } return null; }