Java Code Examples for org.camunda.bpm.engine.authorization.Resource#resourceType()

The following examples show how to use org.camunda.bpm.engine.authorization.Resource#resourceType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultAuthorizationProvider.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected boolean hasEntitySameAuthorizationRights(AuthorizationEntity authEntity, String userId, String groupId,
                                                   Resource resource, String resourceId) {
  boolean sameUserId = areIdsEqual(authEntity.getUserId(), userId);
  boolean sameGroupId = areIdsEqual(authEntity.getGroupId(), groupId);
  boolean sameResourceId = areIdsEqual(authEntity.getResourceId(), (resourceId));
  boolean sameResourceType = authEntity.getResourceType() == resource.resourceType();
  boolean sameAuthorizationType = authEntity.getAuthorizationType() == AUTH_TYPE_GRANT;
  return sameUserId && sameGroupId &&
      sameResourceType && sameResourceId &&
      sameAuthorizationType;
}
 
Example 2
Source File: PermissionCheck.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void setResource(Resource resource) {
  this.resource = resource;

  if (resource != null) {
    resourceType = resource.resourceType();
  }
}
 
Example 3
Source File: ResourceTypeUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * @return <code>true</code> in case the resource with the provided resourceTypeId is contained by the specified list
 */
public static boolean resourceIsContainedInArray(Integer resourceTypeId, Resource[] resources) {
  for (Resource resource : resources) {
    if (resourceTypeId == resource.resourceType()) {
      return true;
    }
  }
  return false;
}
 
Example 4
Source File: ResourceTypeUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Iterates over the {@link Resources} and 
 * returns either the resource with specified <code>resourceType</code> or <code>null</code>.
 */
public static Resource getResourceByType(int resourceType) {
  for (Resource resource : Resources.values()) {
    if (resource.resourceType() == resourceType) {
      return resource;
    }
  }
  return null;
}
 
Example 5
Source File: AuthorizationUserOperationLogTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public String getNameForResource(int resourceType) {
  for (Resource resource : TestResource.values()) {
    if (resourceType == resource.resourceType()) {
      return resource.resourceName();
    }
  }
  return null;
}
 
Example 6
Source File: AuthorizationEntity.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setResource(Resource resource) {
  this.resourceType = resource.resourceType();
}