public void removeGroup(String name, String groupType) { for (Group group : activeGroups) { if (group.getName().equals(name) && group.getGroupType().equals(groupType)) { activeGroups.remove(group); return; } } }
public boolean inGroup(String name, String groupType) { for (Group group : activeGroups) { if (group.getName().equals(name) && group.getGroupType().equals(groupType)) return true; } return false; }
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; } } }
/** * Obtain group id based on groupType mapping from configuration or if this fails just place it under root / * * @param jbidGroup * @param gtnGroupName * @return */ private String obtainMappedId(org.picketlink.idm.api.Group jbidGroup, String gtnGroupName) { String id = orgService.getConfiguration().getParentId(jbidGroup.getGroupType()); if (id != null && orgService.getConfiguration().isForceMembershipOfMappedTypes()) { if (id.endsWith("/*")) { id = id.substring(0, id.length() - 2); } return id + "/" + gtnGroupName; } // All groups not connected to the root should be just below the root return "/" + gtnGroupName; // TODO: make it configurable // throw new IllegalStateException("Group present that is not connected to the root: " + jbidGroup.getName()); }
protected IdentityObject createIdentityObject(Group group) { IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType()); return new SimpleIdentityObject(group.getName(), group.getKey(), iot); }
r.getGroup().getName(), r.getGroup().getGroupType())) { FactHandle fh = getSecurityContext().getFactHandle(r); getSecurityContext().retract(fh);
role.getGroup().getName(), role.getGroup().getGroupType());
for (Role role : identitySession.getRoleManager().findRoles(u, roleType)) { identity.addRole(role.getRoleType().getName(), role.getGroup().getName(), role.getGroup().getGroupType()); identity.addGroup(g.getName(), g.getGroupType());