Methods Summary |
---|
public void | addGroup(org.apache.catalina.Group group)Add a new {@link Group} to those this user belongs to.
synchronized (groups) {
if (!groups.contains(group)) {
groups.add(group);
}
}
|
public void | addRole(org.apache.catalina.Role role)Add a new {@link Role} to those assigned specifically to this user.
synchronized (roles) {
if (!roles.contains(role)) {
roles.add(role);
}
}
|
public java.util.Iterator | getGroups()Return the set of {@link Group}s to which this user belongs.
// ------------------------------------------------------------- Properties
synchronized (groups) {
return (groups.iterator());
}
|
public java.util.Iterator | getRoles()Return the set of {@link Role}s assigned specifically to this user.
synchronized (roles) {
return (roles.iterator());
}
|
public org.apache.catalina.UserDatabase | getUserDatabase()Return the {@link UserDatabase} within which this User is defined.
return (this.database);
|
public boolean | isInGroup(org.apache.catalina.Group group)Is this user in the specified group?
synchronized (groups) {
return (groups.contains(group));
}
|
public boolean | isInRole(org.apache.catalina.Role role)Is this user specifically assigned the specified {@link Role}? This
method does NOT check for roles inherited based on
{@link Group} membership.
synchronized (roles) {
return (roles.contains(role));
}
|
public void | removeGroup(org.apache.catalina.Group group)Remove a {@link Group} from those this user belongs to.
synchronized (groups) {
groups.remove(group);
}
|
public void | removeGroups()Remove all {@link Group}s from those this user belongs to.
synchronized (groups) {
groups.clear();
}
|
public void | removeRole(org.apache.catalina.Role role)Remove a {@link Role} from those assigned to this user.
synchronized (roles) {
roles.remove(role);
}
|
public void | removeRoles()Remove all {@link Role}s from those assigned to this user.
synchronized (roles) {
roles.clear();
}
|
public java.lang.String | toString()Return a String representation of this user in XML format.
IMPLEMENTATION NOTE - For backwards compatibility,
the reader that processes this entry will accept either
username or name for the username
property.
StringBuffer sb = new StringBuffer("<user username=\"");
sb.append(username);
sb.append("\" password=\"");
sb.append(password);
sb.append("\"");
if (fullName != null) {
sb.append(" fullName=\"");
sb.append(fullName);
sb.append("\"");
}
synchronized (groups) {
if (groups.size() > 0) {
sb.append(" groups=\"");
int n = 0;
Iterator values = groups.iterator();
while (values.hasNext()) {
if (n > 0) {
sb.append(',");
}
n++;
sb.append(((Group) values.next()).getGroupname());
}
sb.append("\"");
}
}
synchronized (roles) {
if (roles.size() > 0) {
sb.append(" roles=\"");
int n = 0;
Iterator values = roles.iterator();
while (values.hasNext()) {
if (n > 0) {
sb.append(',");
}
n++;
sb.append(((Role) values.next()).getRolename());
}
sb.append("\"");
}
}
sb.append("/>");
return (sb.toString());
|