stack.add(currentGroup); if (currentGroup.getMemberUsers().contains(user)) { userGroups.add(currentGroup); || currentGroup.isInheritingRoles(); Group group; group = stack.get(i); userGroups.add(group); inherit = !inheritOnly || group.isInheritingRoles(); for (Group group : currentGroup.getMemberGroups()) { addGroups(user, userGroups, group, stack, inheritOnly);
@Override public String toString() { return getName(); }
throws RepositoryException if(conn.hasStatement(null, SesameRealmConstants.OAS_GROUPNAME, this.vf.createLiteral(nextGroup.getName()), true, this.getContexts())) this.vf.createURI("urn:oas:group:", nextGroup.getName() + ":" + UUID.randomUUID().toString()); this.vf.createLiteral(nextGroup.getName())), this.getContexts()); conn.add( this.vf.createStatement(nextGroupUUID, SesameRealmConstants.OAS_GROUPDESCRIPTION, this.vf.createLiteral(nextGroup.getDescription())), this.getContexts()); conn.add( this.vf.createStatement(nextGroupUUID, SesameRealmConstants.OAS_GROUPINHERITINGROLES, this.vf.createLiteral(nextGroup.isInheritingRoles())), this.getContexts()); for(final User nextUser : nextGroup.getMemberUsers()) if(!nextGroup.getMemberGroups().isEmpty()) for(final Group nextMemberGroup : nextGroup.getMemberGroups())
private Group createGroupForStatements(final List<Statement> nextGroupStatements) final Group nextGroup = new Group(); nextGroup.setName(nextStatement.getObject().stringValue()); nextGroup.setDescription(nextStatement.getObject().stringValue()); nextGroup.setInheritingRoles(((Literal)nextStatement.getObject()).booleanValue()); nextGroup.getMemberUsers().add(this.findUser(nextStatement.getObject().stringValue()));
/** * Sets the modifiable list of member user references. This method clears * the current list and adds all entries in the parameter list. * * @param memberUsers * A list of member user references. */ public void setMemberUsers(List<User> memberUsers) { synchronized (getMemberUsers()) { if (memberUsers != getMemberUsers()) { getMemberUsers().clear(); if (memberUsers != null) { getMemberUsers().addAll(memberUsers); } } } }
/** * Sets the modifiable list of member groups. This method clears the current * list and adds all entries in the parameter list. * * @param memberGroups * A list of member groups. */ public void setMemberGroups(List<Group> memberGroups) { synchronized (getMemberGroups()) { if (memberGroups != getMemberGroups()) { getMemberGroups().clear(); if (memberGroups != null) { getMemberGroups().addAll(memberGroups); } } } }
/** * Test method for * {@link com.github.ansell.restletutils.RestletUtilSesameRealm#findGroups(org.restlet.security.User)} * . */ @Test public final void testFindGroupsUser() { final Set<Group> beforeGroups = this.testRealm.findGroups(this.testUserAuthenticated); Assert.assertEquals(0, beforeGroups.size()); this.testRealm.addUser(this.testUserAuthenticated); this.testGroupNotInheriting.getMemberUsers().add(this.testUserAuthenticated); this.testRealm.addRootGroup(this.testGroupNotInheriting); final Set<Group> afterGroups = this.testRealm.findGroups(this.testUserAuthenticated); Assert.assertEquals(1, afterGroups.size()); final Group afterGroup = afterGroups.iterator().next(); Assert.assertEquals(this.testGroupNotInheriting, afterGroup); }
parentGroup.getMemberGroups().add(newGroup);
if(currentGroup.getMemberUsers().contains(user)) boolean inherit = !inheritOnly || currentGroup.isInheritingRoles(); inherit = !inheritOnly || group.isInheritingRoles(); for(final Group group : currentGroup.getMemberGroups())
/** * Unmaps a group defined in a component from a role defined in the application. * * @param group * The source group. * @param role * The target role. */ public void unmap(final Group group, final Role role) { this.unmap(role, SesameRealmConstants.OAS_ROLEMAPPEDGROUP, group.getName()); }
if(currentGroup.getMemberUsers().contains(user)) boolean inherit = !inheritOnly || currentGroup.isInheritingRoles(); Group group; inherit = !inheritOnly || group.isInheritingRoles(); for(final Group group : currentGroup.getMemberGroups())
this.vf.createLiteral(((Group)nextMapping.getSource()).getName())), this.getContexts());
if(nextRootGroup.getName().equals(nextGroupName))