GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
db.users().insertPermissionOnGroup(group, GlobalPermissions.SYSTEM_ADMIN);
UserDto admin = db.users().insertUser();
- db.users().insertPermissionOnUser(admin, GlobalPermissions.SYSTEM_ADMIN);
+ db.users().insertPermissionOnUser(org, admin, GlobalPermissions.SYSTEM_ADMIN);
apply(new GroupPermissionChange(PermissionChange.Operation.REMOVE, GlobalPermissions.SYSTEM_ADMIN, null, groupId));
OrganizationDto otherOrganization = db.organizations().insert();
db.users().insertPermissionOnUser(otherOrganization, rootUser, SYSTEM_ADMIN);
db.users().insertPermissionOnUser(otherOrganization, notRootUser, SYSTEM_ADMIN);
+ // another admin is required so that admin permission can be dropped
+ UserDto anotherAdmin = db.users().insertUser();
+ db.users().insertPermissionOnUser(otherOrganization, anotherAdmin, SYSTEM_ADMIN);
+
loginAsAdmin(otherOrganization);
executeRequest(rootUser, otherOrganization, SYSTEM_ADMIN);