Java Code Examples for org.springframework.security.acls.model.ObjectIdentity#getType()
The following examples show how to use
org.springframework.security.acls.model.ObjectIdentity#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermissionServiceImpl.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
@Override @Transactional public void createPermission(Permission permission) { ObjectIdentity objectIdentity = permission.getObjectIdentity(); checkTypeExists(objectIdentity.getType()); entityHelper.checkEntityExists(objectIdentity); MutableAcl acl = (MutableAcl) mutableAclService.readAclById(objectIdentity); if (!getSuitablePermissionsForType(objectIdentity.getType()) .contains(permission.getPermission())) { throw new PermissionNotSuitableException( permission.getPermission().name(), objectIdentity.getType()); } Sid sid = permission.getSid(); if (getPermissionResponses(acl, false, singleton(sid)).isEmpty()) { acl.insertAce(acl.getEntries().size(), permission.getPermission(), sid, true); mutableAclService.updateAcl(acl); } else { throw new DuplicatePermissionException(objectIdentity, sid); } }
Example 2
Source File: PermissionServiceImpl.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
@Override @Transactional public void updatePermission(Permission permission) { ObjectIdentity objectIdentity = permission.getObjectIdentity(); checkTypeExists(objectIdentity.getType()); entityHelper.checkEntityExists(objectIdentity); MutableAcl acl = (MutableAcl) mutableAclService.readAclById(objectIdentity); if (!getSuitablePermissionsForType(objectIdentity.getType()) .contains(permission.getPermission())) { throw new PermissionNotSuitableException( permission.getPermission().name(), objectIdentity.getType()); } Sid sid = permission.getSid(); Set<LabelledPermission> current = getPermissionsForObject(objectIdentity, singleton(sid), false); if (current.isEmpty()) { throw new UnknownAceException(objectIdentity, sid, "update"); } deleteAce(sid, acl); acl.insertAce(acl.getEntries().size(), permission.getPermission(), sid, true); mutableAclService.updateAcl(acl); }
Example 3
Source File: PermissionServiceDecorator.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
private void checkSuOrOwner(ObjectIdentity objectIdentity) { if (!mutableAclClassService.getAclClassTypes().contains(objectIdentity.getType())) { throw new UnknownTypeException(objectIdentity.getType()); } entityHelper.checkEntityExists(objectIdentity); MutableAcl acl = (MutableAcl) mutableAclService.readAclById(objectIdentity); Sid sid = createSecurityContextSid(); boolean isOwner = acl.getOwner().equals(sid); if (!SecurityUtils.currentUserIsSuOrSystem() && !isOwner) { throw new InsufficientPermissionsException( acl.getObjectIdentity(), Arrays.asList(SUPERUSER, "owner")); } }
Example 4
Source File: InsufficientPermissionsException.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
public InsufficientPermissionsException(ObjectIdentity objectIdentity, List<String> roles) { super(ERROR_CODE); requireNonNull(objectIdentity); this.identifier = objectIdentity.getIdentifier().toString(); this.type = objectIdentity.getType(); this.roles = requireNonNull(roles); }
Example 5
Source File: ObjectIdentityImpl.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
public ObjectIdentityImpl(ObjectIdentity oid) { this(oid.getType(), String.valueOf(oid.getIdentifier())); }
Example 6
Source File: ObjectIdentityData.java From haven-platform with Apache License 2.0 | 4 votes |
public static ObjectIdentityData from(ObjectIdentity objectIdentity) { if(objectIdentity == null || objectIdentity instanceof ObjectIdentityData) { return (ObjectIdentityData) objectIdentity; } return new ObjectIdentityData(objectIdentity.getType(), objectIdentity.getIdentifier()); }
Example 7
Source File: ObjectIdentityImpl.java From kylin with Apache License 2.0 | 4 votes |
public ObjectIdentityImpl(ObjectIdentity oid) { this(oid.getType(), String.valueOf(oid.getIdentifier())); }
Example 8
Source File: AclService.java From Kylin with Apache License 2.0 | 4 votes |
public DomainObjectInfo(ObjectIdentity oid) { super(); this.id = (String) oid.getIdentifier(); this.type = oid.getType(); }