GroupIdOrAnyone group = support.findGroup(dbSession, request);
Optional<ProjectId> projectId = support.findProject(dbSession, request);
- checkProjectAdmin(userSession, projectId);
+ checkProjectAdmin(userSession, group.getOrganizationUuid(), projectId);
PermissionChange change = new GroupPermissionChange(
PermissionChange.Operation.REMOVE,
Optional<ProjectId> projectId = support.findProject(dbSession, request);
OrganizationDto org = support.findOrganization(dbSession, request.param(PARAM_ORGANIZATION_KEY));
- checkProjectAdmin(userSession, projectId);
+ checkProjectAdmin(userSession, org.getUuid(), projectId);
PermissionChange change = new UserPermissionChange(
PermissionChange.Operation.REMOVE,
import org.junit.Test;
import org.sonar.api.web.UserRole;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.user.GroupDto;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.ForbiddenException;
}
private void loginAsAdmin() {
- userSession.login().setGlobalPermissions(SYSTEM_ADMIN);
+ loginAsOrganizationAdmin(db.getDefaultOrganization());
+ }
+
+ private void loginAsOrganizationAdmin(OrganizationDto org) {
+ userSession.login().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
}
}