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 int compare(T o1, T o2) { if (o1 instanceof User && o2 instanceof User) { if (ascending) { return o1.getKey().compareTo(o2.getKey()); } else { return o2.getKey().compareTo(o1.getKey()); } } else { Group g1 = (Group)o1; Group g2 = (Group)o2; if (ascending) { return g1.getName().compareTo(g2.getName()); } else { return g2.getName().compareTo(g1.getName()); } } } });
private static void filterByIdFilter(List<? extends IdentityType> types, String filter) throws Exception { Set<IdentityType> toRemove = new HashSet<IdentityType>(); String regex = Tools.wildcardToRegex(filter); for (IdentityType type : types) { String id = null; if (type instanceof User) { id = type.getKey(); } else if (type instanceof Group) { id = ((Group)type).getName(); } else { // shouldn't happen throw new IllegalStateException(); } if (!id.matches(regex)) { toRemove.add(type); } } for (IdentityType type : toRemove) { types.remove(type); } }
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; } } }
protected IdentityObject createIdentityObject(Group group) { IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType()); return new SimpleIdentityObject(group.getName(), group.getKey(), iot); }
String gtnGroupName = getGtnGroupName(jbidGroup.getName());
r.getGroup().getName(), r.getGroup().getGroupType())) { FactHandle fh = getSecurityContext().getFactHandle(r); getSecurityContext().retract(fh);
role.getGroup().getName(), role.getGroup().getGroupType());