Methods Summary |
---|
public void | addGroup(java.lang.String groupname)Add a new {@link Group} to those this user belongs to.
User user = (User) this.resource;
if (user == null) {
return;
}
Group group = user.getUserDatabase().findGroup(groupname);
if (group == null) {
throw new IllegalArgumentException
("Invalid group name '" + groupname + "'");
}
user.addGroup(group);
|
public void | addRole(java.lang.String rolename)Add a new {@link Role} to those this user belongs to.
User user = (User) this.resource;
if (user == null) {
return;
}
Role role = user.getUserDatabase().findRole(rolename);
if (role == null) {
throw new IllegalArgumentException
("Invalid role name '" + rolename + "'");
}
user.addRole(role);
|
public java.lang.String[] | getGroups()Return the MBean Names of all groups this user is a member of.
// ------------------------------------------------------------- Attributes
User user = (User) this.resource;
ArrayList results = new ArrayList();
Iterator groups = user.getGroups();
while (groups.hasNext()) {
Group group = null;
try {
group = (Group) groups.next();
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), group);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for group " + group);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getRoles()Return the MBean Names of all roles assigned to this user.
User user = (User) this.resource;
ArrayList results = new ArrayList();
Iterator roles = user.getRoles();
while (roles.hasNext()) {
Role role = null;
try {
role = (Role) roles.next();
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), role);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for role " + role);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
|
public void | removeGroup(java.lang.String groupname)Remove a {@link Group} from those this user belongs to.
User user = (User) this.resource;
if (user == null) {
return;
}
Group group = user.getUserDatabase().findGroup(groupname);
if (group == null) {
throw new IllegalArgumentException
("Invalid group name '" + groupname + "'");
}
user.removeGroup(group);
|
public void | removeRole(java.lang.String rolename)Remove a {@link Role} from those this user belongs to.
User user = (User) this.resource;
if (user == null) {
return;
}
Role role = user.getUserDatabase().findRole(rolename);
if (role == null) {
throw new IllegalArgumentException
("Invalid role name '" + rolename + "'");
}
user.removeRole(role);
|