@InheritsPrivileges @AttributeProperty public Group getParentGroup() { return this.parentGroup; }
public void registerRelationshipType(Class<? extends Relationship> relationshipType) { if (!privilegeChains.containsKey(relationshipType)) { List<Property<IdentityType>> properties = PropertyQueries.<IdentityType>createQuery(relationshipType) .addCriteria(new AnnotatedPropertyCriteria(InheritsPrivileges.class)) .addCriteria(new TypedPropertyCriteria(IdentityType.class, TypedPropertyCriteria.MatchOption.ALL)) .getResultList(); Map<Property<IdentityType>,Property<IdentityType>> inheritanceMapping = new HashMap<Property<IdentityType>,Property<IdentityType>>(); for (Property<IdentityType> p : properties) { InheritsPrivileges annotation = p.getAnnotatedElement().getAnnotation(InheritsPrivileges.class); String assigneeName = annotation.value(); if (StringUtil.isNullOrEmpty(assigneeName)) { throw new IllegalArgumentException(String.format("Specified relationshipType [%s] does not declare valid " + "@InheritsPrivilege annotation on property [%s] - missing assignee property name", relationshipType.getName(), p.getName())); } // Lookup the assignee property by name Property<IdentityType> assignee = PropertyQueries.<IdentityType>createQuery(relationshipType) .addCriteria(new NamedPropertyCriteria(assigneeName)) .getSingleResult(); inheritanceMapping.put(p, assignee); } privilegeChains.put(relationshipType, inheritanceMapping); } }
public void registerRelationshipType(Class<? extends Relationship> relationshipType) { if (!privilegeChains.containsKey(relationshipType)) { List<Property<IdentityType>> properties = PropertyQueries.<IdentityType>createQuery(relationshipType) .addCriteria(new AnnotatedPropertyCriteria(InheritsPrivileges.class)) .addCriteria(new TypedPropertyCriteria(IdentityType.class, TypedPropertyCriteria.MatchOption.ALL)) .getResultList(); Map<Property<IdentityType>,Property<IdentityType>> inheritanceMapping = new HashMap<Property<IdentityType>,Property<IdentityType>>(); for (Property<IdentityType> p : properties) { InheritsPrivileges annotation = p.getAnnotatedElement().getAnnotation(InheritsPrivileges.class); String assigneeName = annotation.value(); if (StringUtil.isNullOrEmpty(assigneeName)) { throw new IllegalArgumentException(String.format("Specified relationshipType [%s] does not declare valid " + "@InheritsPrivilege annotation on property [%s] - missing assignee property name", relationshipType.getName(), p.getName())); } // Lookup the assignee property by name Property<IdentityType> assignee = PropertyQueries.<IdentityType>createQuery(relationshipType) .addCriteria(new NamedPropertyCriteria(assigneeName)) .getSingleResult(); inheritanceMapping.put(p, assignee); } privilegeChains.put(relationshipType, inheritanceMapping); } }
@InheritsPrivileges("role") @StereotypeProperty(RELATIONSHIP_GRANT_ASSIGNEE) public IdentityType getAssignee() { return assignee; }
@InheritsPrivileges("group") @StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER) public Account getMember() { return member; }
@InheritsPrivileges("group") @StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER) public Account getMember() { return member; }
@InheritsPrivileges("role") @StereotypeProperty(RELATIONSHIP_GRANT_ASSIGNEE) public IdentityType getAssignee() { return assignee; }
@InheritsPrivileges @AttributeProperty public Group getParentGroup() { return this.parentGroup; }