Search in sources :

Example 1 with PackageIdentity

use of org.molgenis.data.security.PackageIdentity in project molgenis by molgenis.

the class EntityTypeRepositorySecurityDecorator method createAcl.

@Override
public void createAcl(EntityType entityType) {
    MutableAcl acl = mutableAclService.createAcl(new EntityTypeIdentity(entityType.getId()));
    Package pack = entityType.getPackage();
    if (pack != null) {
        ObjectIdentity objectIdentity = new PackageIdentity(pack);
        acl.setParent(mutableAclService.readAclById(objectIdentity));
        mutableAclService.updateAcl(acl);
    }
}
Also used : EntityTypeIdentity(org.molgenis.data.security.EntityTypeIdentity) ObjectIdentity(org.springframework.security.acls.model.ObjectIdentity) PackageIdentity(org.molgenis.data.security.PackageIdentity) MutableAcl(org.springframework.security.acls.model.MutableAcl) Package(org.molgenis.data.meta.model.Package)

Example 2 with PackageIdentity

use of org.molgenis.data.security.PackageIdentity in project molgenis by molgenis.

the class EntityTypeRepositorySecurityDecorator method updateAcl.

@Override
public void updateAcl(EntityType entityType) {
    MutableAcl acl = (MutableAcl) mutableAclService.readAclById(new EntityTypeIdentity(entityType.getId()));
    Package pack = entityType.getPackage();
    if (pack != null) {
        ObjectIdentity objectIdentity = new PackageIdentity(pack);
        Acl parentAcl = mutableAclService.readAclById(objectIdentity);
        if (!parentAcl.equals(acl.getParentAcl())) {
            acl.setParent(parentAcl);
            mutableAclService.updateAcl(acl);
        }
    }
}
Also used : EntityTypeIdentity(org.molgenis.data.security.EntityTypeIdentity) ObjectIdentity(org.springframework.security.acls.model.ObjectIdentity) PackageIdentity(org.molgenis.data.security.PackageIdentity) MutableAcl(org.springframework.security.acls.model.MutableAcl) Package(org.molgenis.data.meta.model.Package) Acl(org.springframework.security.acls.model.Acl) MutableAcl(org.springframework.security.acls.model.MutableAcl)

Example 3 with PackageIdentity

use of org.molgenis.data.security.PackageIdentity in project molgenis by molgenis.

the class PackageRepositorySecurityDecorator method deleteAcl.

private void deleteAcl(String id) {
    PackageIdentity packageIdentity = new PackageIdentity(id);
    mutableAclService.deleteAcl(packageIdentity, true);
}
Also used : PackageIdentity(org.molgenis.data.security.PackageIdentity)

Example 4 with PackageIdentity

use of org.molgenis.data.security.PackageIdentity in project molgenis by molgenis.

the class PackageRepositorySecurityDecorator method updateAcl.

private void updateAcl(Package pack) {
    PackageIdentity packageIdentity = new PackageIdentity(pack);
    MutableAcl acl = (MutableAcl) mutableAclService.readAclById(packageIdentity);
    if (pack.getParent() != null) {
        ObjectIdentity parentIdentity = new PackageIdentity(pack.getParent());
        Acl parentAcl = mutableAclService.readAclById(parentIdentity);
        if (!parentAcl.equals(acl.getParentAcl())) {
            acl.setParent(parentAcl);
            mutableAclService.updateAcl(acl);
        }
    }
}
Also used : ObjectIdentity(org.springframework.security.acls.model.ObjectIdentity) PackageIdentity(org.molgenis.data.security.PackageIdentity) MutableAcl(org.springframework.security.acls.model.MutableAcl) Acl(org.springframework.security.acls.model.Acl) MutableAcl(org.springframework.security.acls.model.MutableAcl)

Example 5 with PackageIdentity

use of org.molgenis.data.security.PackageIdentity in project molgenis by molgenis.

the class PackageRepositorySecurityDecorator method createAcl.

private void createAcl(Package pack) {
    PackageIdentity packageIdentity = new PackageIdentity(pack);
    MutableAcl acl = mutableAclService.createAcl(packageIdentity);
    if (pack.getParent() != null) {
        ObjectIdentity parentIdentity = new PackageIdentity(pack.getParent());
        Acl parentAcl = mutableAclService.readAclById(parentIdentity);
        acl.setParent(parentAcl);
        mutableAclService.updateAcl(acl);
    }
}
Also used : ObjectIdentity(org.springframework.security.acls.model.ObjectIdentity) PackageIdentity(org.molgenis.data.security.PackageIdentity) MutableAcl(org.springframework.security.acls.model.MutableAcl) Acl(org.springframework.security.acls.model.Acl) MutableAcl(org.springframework.security.acls.model.MutableAcl)

Aggregations

PackageIdentity (org.molgenis.data.security.PackageIdentity)10 Package (org.molgenis.data.meta.model.Package)6 MutableAcl (org.springframework.security.acls.model.MutableAcl)6 ObjectIdentity (org.springframework.security.acls.model.ObjectIdentity)4 Test (org.testng.annotations.Test)4 EntityTypeIdentity (org.molgenis.data.security.EntityTypeIdentity)3 Acl (org.springframework.security.acls.model.Acl)3 EntityType (org.molgenis.data.meta.model.EntityType)1 Plugin (org.molgenis.data.plugin.model.Plugin)1 PluginIdentity (org.molgenis.data.plugin.model.PluginIdentity)1 Group (org.molgenis.data.security.auth.Group)1 User (org.molgenis.data.security.auth.User)1 CumulativePermission (org.springframework.security.acls.domain.CumulativePermission)1 GrantedAuthoritySid (org.springframework.security.acls.domain.GrantedAuthoritySid)1 PrincipalSid (org.springframework.security.acls.domain.PrincipalSid)1 BeforeMethod (org.testng.annotations.BeforeMethod)1