Bug 5080: added meta permission check if the current user has all roles

implicated by a user group before allowing him to add a user (possibly
himself) to a user group
This commit is contained in:
Steffen Jacobs authored and Steffen Schaefer committed 2019-06-27 14:19:08 +02:00
1 parent 02b59ca833
commit aa56707ba6
1 file changed
+7 -2
@@ -198,8 +198,13 @@ public class UserGroupResource extends AbstractSecurityResource {
.build();
} else {
if (getService().hasCurrentUserUpdatePermission(usergroup)) {
getService().addUserToUserGroup(usergroup, user);
response = Response.ok().build();
if (!getService().hasCurrentUserMetaPermissionsOfRoleDefinitionsWithQualification(
usergroup.getRoleDefinitionMap().keySet(), new Ownership(null, usergroup))) {
response = Response.status(Status.UNAUTHORIZED).build();
} else {
getService().addUserToUserGroup(usergroup, user);
response = Response.ok().build();
}
} else {
response = Response.status(Status.UNAUTHORIZED).build();
}