Search in sources :

Example 11 with ProjectId

use of org.sonar.server.permission.ProjectId in project sonarqube by SonarSource.

the class RemoveGroupAction method handle.

@Override
public void handle(Request request, Response response) throws Exception {
    try (DbSession dbSession = dbClient.openSession(false)) {
        GroupIdOrAnyone group = support.findGroup(dbSession, request);
        Optional<ProjectId> projectId = support.findProjectId(dbSession, request);
        checkProjectAdmin(userSession, group.getOrganizationUuid(), projectId);
        PermissionChange change = new GroupPermissionChange(PermissionChange.Operation.REMOVE, request.mandatoryParam(PARAM_PERMISSION), projectId.orElse(null), group);
        permissionUpdater.apply(dbSession, asList(change));
    }
    response.noContent();
}
Also used : DbSession(org.sonar.db.DbSession) PermissionChange(org.sonar.server.permission.PermissionChange) GroupPermissionChange(org.sonar.server.permission.GroupPermissionChange) ProjectId(org.sonar.server.permission.ProjectId) GroupIdOrAnyone(org.sonar.server.usergroups.ws.GroupIdOrAnyone) GroupPermissionChange(org.sonar.server.permission.GroupPermissionChange)

Aggregations

ProjectId (org.sonar.server.permission.ProjectId)11 DbSession (org.sonar.db.DbSession)6 GroupPermissionChange (org.sonar.server.permission.GroupPermissionChange)6 OrganizationDto (org.sonar.db.organization.OrganizationDto)5 PermissionChange (org.sonar.server.permission.PermissionChange)4 PermissionUpdater (org.sonar.server.permission.PermissionUpdater)4 ComponentDto (org.sonar.db.component.ComponentDto)3 Paging (org.sonar.api.utils.Paging)2 PermissionQuery (org.sonar.db.permission.PermissionQuery)2 UserId (org.sonar.server.permission.UserId)2 UserPermissionChange (org.sonar.server.permission.UserPermissionChange)2 GroupIdOrAnyone (org.sonar.server.usergroups.ws.GroupIdOrAnyone)2 ComponentDao (org.sonar.db.component.ComponentDao)1 OrganizationDao (org.sonar.db.organization.OrganizationDao)1 GroupPermissionDto (org.sonar.db.permission.GroupPermissionDto)1 UserPermissionDto (org.sonar.db.permission.UserPermissionDto)1 GroupDto (org.sonar.db.user.GroupDto)1 UserDto (org.sonar.db.user.UserDto)1 NotFoundException (org.sonar.server.exceptions.NotFoundException)1 UsersWsResponse (org.sonarqube.ws.WsPermissions.UsersWsResponse)1