public void putRoleType(String ns, RoleType role) { Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPES, role.getName()); Node ioNode = addNode(nodeFqn); if (ioNode != null) { ioNode.put(NODE_OBJECT_KEY, role); if (log.isLoggable(Level.FINER)) { log.finer(this.toString() + "RoleType stored in cache: name=" + role.getName() + ";namespace=" + ns); } } }
public RoleType getRoleType(String ns, RoleType role) { Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPES, role.getName()); Node node = getNode(nodeFqn); if (node != null) { RoleType result = (RoleType)node.get(NODE_OBJECT_KEY); if (log.isLoggable(Level.FINER) && result != null) { log.finer(this.toString() + "RoleType found in cache: name=" + role.getName() + ";namespace=" + ns); } return result; } return null; }
public void removeRoleType(RoleType roleType) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); removeRoleType(roleType.getName()); }
public void removeRoleType(String ns, RoleType roleType) { removeNode(getFqn(ns, NODE_ROLE_TYPES, roleType.getName())); }
public boolean hasRole(String roleType, String group, String groupType) { if (!securityEnabled) return true; if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true; tryLogin(); for (Role role : activeRoles) { if (role.getRoleType().getName().equals(roleType) && role.getGroup().getName().equals(group) && role.getGroup().getGroupType().equals(groupType)) { return true; } } return false; }
/** * Removes a role from the authenticated user * * @param role The name of the role to remove */ public void removeRole(String roleType, String group, String groupType) { for (Role role : activeRoles) { if (role.getRoleType().getName().equals(roleType) && role.getGroup().getName().equals(group) && role.getGroup().getGroupType().equals(groupType)) { activeRoles.remove(role); return; } } }
public Collection<MembershipType> findMembershipTypes() throws Exception { if (log.isTraceEnabled()) { Tools.logMethodIn(log, LogLevel.TRACE, "findMembershipTypes", null); } Collection<RoleType> rts; try { rts = getIdentitySession().getRoleManager().findRoleTypes(); } catch (Exception e) { handleException("Exception occured when looking for membership types", e); rts = new LinkedList<RoleType>(); } List<MembershipType> mts = new LinkedList<MembershipType>(); for (RoleType rt : rts) { MembershipType mt = new MembershipTypeImpl(rt.getName(), null, null); populateMembershipType(mt); if (mt.getName().equals("*")) { mts.add(0, mt); } else { mts.add(mt); } } if (log.isTraceEnabled()) { Tools.logMethodOut(log, LogLevel.TRACE, "findMembershipTypes", mts); } return mts; }
protected IdentityObjectRelationship createIdentityObjectRelationship(Role role) { return new SimpleIdentityObjectRelationship( createIdentityObject(role.getGroup()), createIdentityObject(role.getUser()), role.getRoleType().getName(), ROLE ); }
public void removeProperty(RoleType roleType, String name) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); checkNotNullArgument(name, "Property name"); Set<String> names = new HashSet<String>(); names.add(name); prePropertiesRemove(roleType, names); getRepository().removeRelationshipNameProperties(getInvocationContext(), roleType.getName(), names); if (cache != null) { cache.invalidateRoleTypeProperties(cacheNS, roleType); cache.putProperties(cacheNS, roleType, getProperties(roleType)); } postPropertiesRemove(roleType, names); }
public Map<String, String> getProperties(RoleType roleType) throws IdentityException { checkNotNullArgument(roleType, "RoleType name"); if (cache != null) { Map<String, String> result = cache.getProperties(cacheNS, roleType); if (result != null) { return result; } } Map<String, String> result = getRepository().getRelationshipNameProperties(getInvocationContext(), roleType.getName()); if (cache != null) { cache.putProperties(cacheNS, roleType, result); } return result; }
public void setProperty(RoleType roleType, String name, String value) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); checkNotNullArgument(name, "Property name"); checkNotNullArgument(value, "Property value"); Map<String, String> props = new HashMap<String, String>(); props.put(name, value); prePropertiesSet(roleType, props); getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), props); if (cache != null) { cache.invalidateRoleTypeProperties(cacheNS, roleType); cache.putProperties(cacheNS, roleType, getProperties(roleType)); } postPropertiesSet(roleType, props); }
if (mmm.isCreateMembership(role.getRoleType().getName(), exoGroup.getId())) { exoGroups.add(exoGroup);
if (mmm.isCreateMembership(role.getRoleType().getName(), exoGroup.getId())) { exoGroups.add(exoGroup);
Role r = (Role) iter.next(); if (!identity.hasRole(r.getRoleType().getName(), r.getGroup().getName(), r.getGroup().getGroupType())) { FactHandle fh = getSecurityContext().getFactHandle(r);
public void setProperties(RoleType roleType, Map<String, String> properties) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); checkNotNullArgument(properties, "Properties"); prePropertiesSet(roleType, properties); getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), properties); if (cache != null) { cache.invalidateRoleTypeProperties(cacheNS, roleType); cache.putProperties(cacheNS, roleType, getProperties(roleType)); } postPropertiesSet(roleType, properties); }
if (isCreateMembership(role.getRoleType().getName(), g.getId())) { MembershipImpl m = new MembershipImpl(); m.setGroupId(g.getId()); if (role.getRoleType().getName().equals("JBOSS_IDENTITY_MEMBERSHIP")) { m.setMembershipType(orgService.getConfiguration().getAssociationMembershipType()); } else { m.setMembershipType(role.getRoleType().getName());
public boolean hasRole(User user, Group group, RoleType roleType) throws IdentityException { checkNotNullArgument(roleType, "RoleType"); checkNotNullArgument(user, "User"); checkNotNullArgument(group, "Group"); if (cache != null) { Role role = new SimpleRole(roleType, user, group); role = cache.getRole(cacheNS, role); if (role != null) { return true; } } //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())) { if (cache != null) { Role role = new SimpleRole(roleType, user, group); cache.putRole(cacheNS, role); } return true; } } return false; }
m.setGroupId(g.getId()); m.setUserName(role.getUser().getId()); m.setMembershipType(role.getRoleType().getName()); memberships.add(m);