public boolean hasRole(User user, Group group, RoleType roleType) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); checkNotNullArgument(user, "User"); checkNotNullArgument(group, "Group"); //TODO: does separate hasRelationship method in IdentityStore makes sense? Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE); for (IdentityObjectRelationship rel : rels) { if (rel.getType().getName().equals(ROLE.getName()) && rel.getName() != null && rel.getName().equals(roleType.getName())) { return true; } } return false; }
public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException { Map<String, Set<String>> mappings = supportedRelationshipMappings.get(relationshipType.getName()); if (mappings != null && mappings.containsKey(fromType.getName())) { if (mappings.get(fromType.getName()).contains(toType.getName())) { return true; } } return false; }
protected boolean hasIdentityObject(IdentityStoreInvocationContext ctx, IdentityStore is, IdentityObject io) throws IdentityException { try { if (is.findIdentityObject(ctx, io.getName(), io.getIdentityType()) != null) { return true; } } catch (IdentityException e) { //store may throw exception if there is no identity so do nothing //TODO: should have isIdentityPresent method } return false; }
IdentityStore resolveIdentityStore(IdentityObject io) throws IdentityException { return resolveIdentityStore(io.getIdentityType()); }
public String getGroupType(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } return identityObjectType.getName(); }
public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException { identityStore.removeIdentityObject(invocationCtx, identity); cacheSupport.removeFromCache(identity); cacheSupport.invalidateCachedIdentityObjectSearches(identity); cacheSupport.invalidateCachedIdentityObjectCount(identity.getIdentityType()); }
protected User createUser(IdentityObject identityObject) { return new SimpleUser(identityObject.getName()); }
public boolean isIdentityObjectAddRemoveSupported(IdentityObjectType objectType) { if (readOnlyObjectTypes.contains(objectType.getName())) { return false; } return true; }
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException { checkNotNullArgument(identityType, "IdentityType"); return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType()); }
public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType) { if (supportedTypeNames.contains(identityObjectType.getName())) { return true; } return false; }
public Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType) { return attributesMetaData.get(identityType.getName()); }
public String getGroupType(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } return groupTypeMap.get(identityObjectType.getName()); }
public boolean isIdentity(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } if (identityObjectType.getName().equals(identityTypeName)) { return true; } return false; } }
public boolean isIdentity(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } if (identityObjectType.getName().equals(identityTypeName)) { return true; } return false; } }
@Override public String toString() { return "IdentityObject[id=" + getId() + "; name=" + getName() + "; type=" + getIdentityType().getName() + "]"; } }