List<Group> currentGroups = groupManager.getGroupsForUser(user.getName()); groupManager.removeUserFromGroup(userName, currentGroup.getName()); groupManager.addUserToGroup(userName, groupName);
List<Role> roles = roleManager.getRolesForUser(user.getName()); List<String> availableRoles = roleManager.getRoleNames(null); List<Group> groups = groupManager.getGroupsForUser(user.getName()); List<String> availableGroups = groupManager.getGroupNames(null); List<String> ruleNames = getProfilingRuleNames(); String userRule = getProfilingRuleForUser(user);
try { List roles = roleManager.getRoles("user"); List groups = groupManager.getGroups(""); portalAdministration.registerUser(userName, portalAdministration.generatePassword());
if (!(groupManager.groupExists(name))) groupManager.addGroup(name); Group group = groupManager.getGroup(name); refs.getPrincipalMap(JetspeedPrincipalType.GROUP).put(name, group); while (_itTemp.hasNext()) groupManager.addUserToGroup(jsuser.getName(), _itTemp.next());
/** * @see org.apache.jetspeed.security.RoleManager#removeRoleFromGroup(java.lang.String, * java.lang.String) */ public void removeRoleFromGroup(String roleName, String groupName) throws SecurityException { checkInitialized(); Group group = groupManager.getGroup(groupName); if (group == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.GROUP, groupName)); } Role role = getRole(roleName); if (role == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName)); } super.removeAssociation(group, role, JetspeedPrincipalAssociationType.IS_MEMBER_OF); }
for (String group : groups) { if (group.trim().length() > 0) { groupManager.addUserToGroup(userName, group);
/** * @see org.apache.jetspeed.security.RoleManager#addRoleToGroup(java.lang.String, * java.lang.String) */ public void addRoleToGroup(String roleName, String groupName) throws SecurityException { checkInitialized(); Group group = groupManager.getGroup(groupName); if (group == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.GROUP, groupName)); } Role role = getRole(roleName); if (role == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName)); } super.addAssociation(group, role, JetspeedPrincipalAssociationType.IS_MEMBER_OF); }
principal = groupManager.getGroup(pName);