use of org.apache.karaf.jaas.boot.principal.GroupPrincipal in project fabric8 by jboss-fuse.
the class ZookeeperBackingEngine method addRole.
/**
* Add a role to a User.
*/
public void addRole(String username, String role) {
String userInfos = users.get(username);
if (userInfos != null) {
for (RolePrincipal rp : listRoles(username)) {
if (role.equals(rp.getName())) {
return;
}
}
for (GroupPrincipal gp : listGroups(username)) {
if (role.equals(GROUP_PREFIX + gp.getName())) {
return;
}
}
String newUserInfos = userInfos + "," + role;
users.put(username, newUserInfos);
}
saveUserProperties();
}
Aggregations