use of com.synopsys.integration.alert.common.persistence.model.PermissionKey in project hub-alert by blackducksoftware.
the class RoleActions method convertPermissionMatrixModel.
private Set<PermissionModel> convertPermissionMatrixModel(PermissionMatrixModel permissionMatrixModel) {
Set<PermissionModel> permissionMatrix = new HashSet<>();
for (Map.Entry<PermissionKey, Integer> matrixRow : permissionMatrixModel.getPermissions().entrySet()) {
Integer accessOperations = matrixRow.getValue();
PermissionKey permissionKey = matrixRow.getKey();
String descriptorDisplayName = descriptorMap.getDescriptorKey(permissionKey.getDescriptorName()).map(DescriptorKey::getDisplayName).orElse(permissionKey.getDescriptorName());
PermissionModel permissionModel = new PermissionModel(descriptorDisplayName, permissionKey.getContext(), BitwiseUtil.containsBits(accessOperations, AccessOperation.CREATE.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.READ.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.WRITE.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.DELETE.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.EXECUTE.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.UPLOAD_FILE_READ.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.UPLOAD_FILE_WRITE.getBit()), BitwiseUtil.containsBits(accessOperations, AccessOperation.UPLOAD_FILE_DELETE.getBit()));
permissionMatrix.add(permissionModel);
}
return permissionMatrix;
}
Aggregations