public List<String> filterAuthenticatedGroupIds(List<String> authenticatedGroupIds) { if(authenticatedGroupIds == null || authenticatedGroupIds.isEmpty()) { return EMPTY_LIST; } else { if(availableAuthorizedGroupIds == null) { availableAuthorizedGroupIds = new HashSet<String>(getDbEntityManager().selectList("selectAuthorizedGroupIds")); } Set<String> copy = new HashSet<String>(availableAuthorizedGroupIds); copy.retainAll(authenticatedGroupIds); return new ArrayList<String>(copy); } }
public List<String> filterAuthenticatedGroupIds(List<String> authenticatedGroupIds) { if(authenticatedGroupIds == null || authenticatedGroupIds.isEmpty()) { return EMPTY_LIST; } else { if(availableAuthorizedGroupIds == null) { availableAuthorizedGroupIds = new HashSet<String>(getDbEntityManager().selectList("selectAuthorizedGroupIds")); } Set<String> copy = new HashSet<String>(availableAuthorizedGroupIds); copy.retainAll(authenticatedGroupIds); return new ArrayList<String>(copy); } }
public AuthorizationEntity findAuthorization(int type, String userId, String groupId, Resource resource, String resourceId) { Map<String, Object> params = new HashMap<String, Object>(); params.put("type", type); params.put("userId", userId); params.put("groupId", groupId); params.put("resourceId", resourceId); if (resource != null) { params.put("resourceType", resource.resourceType()); } return (AuthorizationEntity) getDbEntityManager().selectOne("selectAuthorizationByParameters", params); }
public AuthorizationEntity findAuthorization(int type, String userId, String groupId, Resource resource, String resourceId) { Map<String, Object> params = new HashMap<String, Object>(); params.put("type", type); params.put("userId", userId); params.put("groupId", groupId); params.put("resourceId", resourceId); if (resource != null) { params.put("resourceType", resource.resourceType()); } return (AuthorizationEntity) getDbEntityManager().selectOne("selectAuthorizationByParameters", params); }
public void deleteAuthorizationsByResourceIdAndUserId(Resource resource, String resourceId, String userId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); deleteParams.put("userId", userId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
public void deleteAuthorizationsByResourceId(Resource resource, String resourceId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
public void deleteAuthorizationsByResourceIdAndUserId(Resource resource, String resourceId, String userId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); deleteParams.put("userId", userId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
public void deleteAuthorizationsByResourceIdAndGroupId(Resource resource, String resourceId, String groupId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); deleteParams.put("groupId", groupId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
public void deleteAuthorizationsByResourceIdAndGroupId(Resource resource, String resourceId, String groupId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); deleteParams.put("groupId", groupId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
public void deleteAuthorizationsByResourceId(Resource resource, String resourceId) { if(resourceId == null) { throw new IllegalArgumentException("Resource id cannot be null"); } if(isAuthorizationEnabled()) { Map<String, Object> deleteParams = new HashMap<String, Object>(); deleteParams.put("resourceType", resource.resourceType()); deleteParams.put("resourceId", resourceId); getDbEntityManager().delete(AuthorizationEntity.class, "deleteAuthorizationsForResourceId", deleteParams); } }
@Override public void insert(DbEntity authorization) { checkAuthorization(CREATE, AUTHORIZATION, null); getDbEntityManager().insert(authorization); }
public List<Authorization> selectAuthorizationByQueryCriteria(AuthorizationQueryImpl authorizationQuery) { configureQuery(authorizationQuery, AUTHORIZATION); return getDbEntityManager().selectList("selectAuthorizationByQueryCriteria", authorizationQuery); }
@Override public void insert(DbEntity authorization) { checkAuthorization(CREATE, AUTHORIZATION, null); getDbEntityManager().insert(authorization); }
public Long selectAuthorizationCountByQueryCriteria(AuthorizationQueryImpl authorizationQuery) { configureQuery(authorizationQuery, AUTHORIZATION); return (Long) getDbEntityManager().selectOne("selectAuthorizationCountByQueryCriteria", authorizationQuery); }
public Long selectAuthorizationCountByQueryCriteria(AuthorizationQueryImpl authorizationQuery) { configureQuery(authorizationQuery, AUTHORIZATION); return (Long) getDbEntityManager().selectOne("selectAuthorizationCountByQueryCriteria", authorizationQuery); }
public List<Authorization> selectAuthorizationByQueryCriteria(AuthorizationQueryImpl authorizationQuery) { configureQuery(authorizationQuery, AUTHORIZATION); return getDbEntityManager().selectList("selectAuthorizationByQueryCriteria", authorizationQuery); }
public void update(AuthorizationEntity authorization) { checkAuthorization(UPDATE, AUTHORIZATION, authorization.getId()); getDbEntityManager().merge(authorization); }
public void update(AuthorizationEntity authorization) { checkAuthorization(UPDATE, AUTHORIZATION, authorization.getId()); getDbEntityManager().merge(authorization); }
public boolean isAuthorized(String userId, List<String> groupIds, CompositePermissionCheck compositePermissionCheck) { for (PermissionCheck permissionCheck : compositePermissionCheck.getAllPermissionChecks()) { if (!isResourceValidForPermission(permissionCheck)) { throw LOG.invalidResourceForPermission(permissionCheck.getResource().resourceName(), permissionCheck.getPermission().getName()); } } List<String> filteredGroupIds = filterAuthenticatedGroupIds(groupIds); boolean isRevokeAuthorizationCheckEnabled = isRevokeAuthCheckEnabled(userId, groupIds); AuthorizationCheck authCheck = new AuthorizationCheck(userId, filteredGroupIds, compositePermissionCheck, isRevokeAuthorizationCheckEnabled); return getDbEntityManager().selectBoolean("isUserAuthorizedForResource", authCheck); }
public boolean isAuthorized(String userId, List<String> groupIds, CompositePermissionCheck compositePermissionCheck) { for (PermissionCheck permissionCheck : compositePermissionCheck.getAllPermissionChecks()) { if (!isResourceValidForPermission(permissionCheck)) { throw LOG.invalidResourceForPermission(permissionCheck.getResource().resourceName(), permissionCheck.getPermission().getName()); } } List<String> filteredGroupIds = filterAuthenticatedGroupIds(groupIds); boolean isRevokeAuthorizationCheckEnabled = isRevokeAuthCheckEnabled(userId, groupIds); AuthorizationCheck authCheck = new AuthorizationCheck(userId, filteredGroupIds, compositePermissionCheck, isRevokeAuthorizationCheckEnabled); return getDbEntityManager().selectBoolean("isUserAuthorizedForResource", authCheck); }