/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/ package org.apache.catalina.mbeans;
/** * Add a new {@link Group} to those this user belongs to. * * @param groupname Group name of the new group
*/ publicvoid addGroup(String groupname) {
User user = (User) this.resource; if (user == null) { return;
}
Group group = user.getUserDatabase().findGroup(groupname); if (group == null) { thrownew IllegalArgumentException(sm.getString("userMBean.invalidGroup", groupname));
}
user.addGroup(group);
}
/** * Add a new {@link Role} to those this user belongs to. * * @param rolename Role name of the new role
*/ publicvoid addRole(String rolename) {
User user = (User) this.resource; if (user == null) { return;
}
Role role = user.getUserDatabase().findRole(rolename); if (role == null) { thrownew IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
}
user.addRole(role);
}
/** * Remove a {@link Group} from those this user belongs to. * * @param groupname Group name of the old group
*/ publicvoid removeGroup(String groupname) {
User user = (User) this.resource; if (user == null) { return;
}
Group group = user.getUserDatabase().findGroup(groupname); if (group == null) { thrownew IllegalArgumentException(sm.getString("userMBean.invalidGroup", groupname));
}
user.removeGroup(group);
}
/** * Remove a {@link Role} from those this user belongs to. * * @param rolename Role name of the old role
*/ publicvoid removeRole(String rolename) {
User user = (User) this.resource; if (user == null) { return;
}
Role role = user.getUserDatabase().findRole(rolename); if (role == null) { thrownew IllegalArgumentException(sm.getString("userMBean.invalidRole", rolename));
}
user.removeRole(role);
}
}
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.