use of org.molgenis.data.security.EntityTypePermission in project molgenis by molgenis.
the class EmxImportServiceIT method populateUserPermissions.
private void populateUserPermissions() {
Sid sid = new PrincipalSid(SecurityUtils.getCurrentUsername());
Map<String, EntityTypePermission> entityTypePermissionMap = new HashMap<>();
entityTypePermissionMap.put("sys_md_Package", READ);
entityTypePermissionMap.put("sys_md_EntityType", READ);
entityTypePermissionMap.put("sys_md_Attribute", READ);
entityTypePermissionMap.put("sys_md_Tag", READ);
entityTypePermissionMap.put("sys_FileMeta", READ);
entityTypePermissionMap.put("sys_dec_DecoratorConfiguration", READ);
runAsSystem(() -> entityTypePermissionMap.forEach((entityTypeId, permission) -> {
MutableAcl acl = (MutableAcl) mutableAclService.readAclById(new EntityTypeIdentity(entityTypeId));
acl.insertAce(acl.getEntries().size(), getCumulativePermission(permission), sid, true);
mutableAclService.updateAcl(acl);
}));
}
use of org.molgenis.data.security.EntityTypePermission in project molgenis by molgenis.
the class OntologyImportServiceIT method populateUserPermissions.
private void populateUserPermissions() {
Sid sid = new PrincipalSid(SecurityUtils.getCurrentUsername());
Map<String, EntityTypePermission> entityTypePermissionMap = new HashMap<>();
entityTypePermissionMap.put("sys_ont_OntologyTermDynamicAnnotation", WRITE);
entityTypePermissionMap.put("sys_ont_OntologyTermNodePath", WRITE);
entityTypePermissionMap.put("sys_ont_OntologyTermSynonym", WRITE);
entityTypePermissionMap.put("sys_ont_Ontology", WRITE);
entityTypePermissionMap.put("sys_ont_OntologyTerm", WRITE);
entityTypePermissionMap.put("sys_dec_DecoratorConfiguration", READ);
runAsSystem(() -> entityTypePermissionMap.forEach((entityTypeId, permission) -> {
MutableAcl acl = (MutableAcl) mutableAclService.readAclById(new EntityTypeIdentity(entityTypeId));
acl.insertAce(acl.getEntries().size(), getCumulativePermission(permission), sid, true);
mutableAclService.updateAcl(acl);
}));
}
use of org.molgenis.data.security.EntityTypePermission in project molgenis by molgenis.
the class TestPermissionPopulator method populate.
/**
* Populate entity type permissions for the current user.
*/
@Transactional
public void populate(Map<String, EntityTypePermission> entityTypePermissionMap, String username) {
Sid sid = new PrincipalSid(username);
runAsSystem(() -> entityTypePermissionMap.forEach((entityTypeId, permission) -> {
MutableAcl acl = (MutableAcl) mutableAclService.readAclById(new EntityTypeIdentity(entityTypeId));
acl.insertAce(acl.getEntries().size(), getCumulativePermission(permission), sid, true);
mutableAclService.updateAcl(acl);
}));
}
use of org.molgenis.data.security.EntityTypePermission in project molgenis by molgenis.
the class VcfImportServiceIT method populateUserPermissions.
private void populateUserPermissions() {
Sid sid = new PrincipalSid(SecurityUtils.getCurrentUsername());
Map<String, EntityTypePermission> entityTypePermissionMap = new HashMap<>();
entityTypePermissionMap.put("sys_md_Package", READ);
entityTypePermissionMap.put("sys_md_EntityType", READ);
entityTypePermissionMap.put("sys_md_Attribute", READ);
entityTypePermissionMap.put("sys_dec_DecoratorConfiguration", READ);
runAsSystem(() -> entityTypePermissionMap.forEach((entityTypeId, permission) -> {
MutableAcl acl = (MutableAcl) mutableAclService.readAclById(new EntityTypeIdentity(entityTypeId));
acl.insertAce(acl.getEntries().size(), getCumulativePermission(permission), sid, true);
mutableAclService.updateAcl(acl);
}));
}
Aggregations