// 2.1) Does role exist with that name
if(cname!=null && q.roleDAO().read(trans, parent, cname).isOKhasData()) {
- return Result.err(Status.ERR_ConflictAlreadyExists,
+ return Result.err(Status.ERR_ConflictAlreadyExists,
"Role exists with that name");
}
// 2.2) Do perms exist with that name
if(cname!=null && q.permDAO().readByType(trans, parent, cname).isOKhasData()) {
- return Result.err(Status.ERR_ConflictAlreadyExists,
+ return Result.err(Status.ERR_ConflictAlreadyExists,
"Perms exist with that name");
}
// Attached to any Roles?
if (fullperm.roles != null) {
- if (force) {
+ if (force || fullperm.roles.contains(user+":user")) {
for (String role : fullperm.roles) {
Result<Void> rv = null;
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, q, role);