use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourcePermissionEventsListener method deleteEnvironmentPermissionOn.
private void deleteEnvironmentPermissionOn(String environmentId, Class<?>... resourceClasses) throws IOException, ClassNotFoundException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("environmentPermissions", FilterBuilders.termFilter("environmentPermissions.key", environmentId));
deletePermissions(resourceFilter, environmentId, ((resource, subjectId) -> resourcePermissionService.revokePermission(resource, Subject.ENVIRONMENT, subjectId)), resourceClasses);
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourcePermissionEventsListener method deleteUserPermissionOn.
private void deleteUserPermissionOn(String username, Class<?>... resourceClasses) throws IOException, ClassNotFoundException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("userPermissions", FilterBuilders.termFilter("userPermissions.key", username));
deletePermissions(resourceFilter, username, ((resource, subjectId) -> resourcePermissionService.revokePermission(resource, Subject.USER, subjectId)), resourceClasses);
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class DeploymentService method buildDeploymentFilters.
private FilterBuilder buildDeploymentFilters(String orchestratorId, String sourceId, String environmentId) {
FilterBuilder filterBuilder = null;
if (orchestratorId != null) {
FilterBuilder orchestratorFilter = FilterBuilders.termFilter("orchestratorId", orchestratorId);
filterBuilder = filterBuilder == null ? orchestratorFilter : FilterBuilders.andFilter(orchestratorFilter, filterBuilder);
}
if (environmentId != null) {
FilterBuilder environmentFilter = FilterBuilders.termFilter("environmentId", environmentId);
filterBuilder = filterBuilder == null ? environmentFilter : FilterBuilders.andFilter(environmentFilter, filterBuilder);
}
if (sourceId != null) {
FilterBuilder sourceFilter = FilterBuilders.termFilter("sourceId", sourceId);
filterBuilder = filterBuilder == null ? sourceFilter : FilterBuilders.andFilter(sourceFilter, filterBuilder);
}
return filterBuilder;
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourceRoleService method deleteGroupRoles.
/**
* Delete a groupRoles entry (groupId) in all ISecuredResource object
*
* @param groupId group id to remove in groupRoles
* @throws ClassNotFoundException
* @throws IOException
*/
private void deleteGroupRoles(String groupId) throws ClassNotFoundException, IOException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("groupRoles", FilterBuilders.termFilter("groupRoles.key", groupId));
deleteRoles(resourceFilter, groupId, new DeleteRoleVisitor() {
@Override
public void deleteRoleOfOwner(Object[] securedResources, String owner) {
deleteRoleOfGroup(securedResources, owner);
}
});
}
use of org.elasticsearch.index.query.FilterBuilder in project alien4cloud by alien4cloud.
the class ResourceRoleService method deleteUserRoles.
/**
* Delete a userRoles entry (userId) in all ISecuredResource object
*
* @param userId user id (username) to remove in userRoles
* @throws ClassNotFoundException
* @throws IOException
*/
private void deleteUserRoles(String userId) throws ClassNotFoundException, IOException {
FilterBuilder resourceFilter = FilterBuilders.nestedFilter("userRoles", FilterBuilders.termFilter("userRoles.key", userId));
deleteRoles(resourceFilter, userId, new DeleteRoleVisitor() {
@Override
public void deleteRoleOfOwner(Object[] securedResources, String owner) {
deleteRoleOfUser(securedResources, owner);
}
});
}
Aggregations