Search in sources :

Example 6 with GroupPermissionChange

use of org.sonar.server.permission.GroupPermissionChange 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

GroupPermissionChange (org.sonar.server.permission.GroupPermissionChange)6 ProjectId (org.sonar.server.permission.ProjectId)6 PermissionUpdater (org.sonar.server.permission.PermissionUpdater)4 DbSession (org.sonar.db.DbSession)2 PermissionChange (org.sonar.server.permission.PermissionChange)2 GroupIdOrAnyone (org.sonar.server.usergroups.ws.GroupIdOrAnyone)2 ComponentDao (org.sonar.db.component.ComponentDao)1 ComponentDto (org.sonar.db.component.ComponentDto)1 OrganizationDao (org.sonar.db.organization.OrganizationDao)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1