use of org.sonar.db.permission.GroupPermissionDto in project sonarqube by SonarSource.
the class UserDbTester method insertProjectPermissionOnAnyone.
public GroupPermissionDto insertProjectPermissionOnAnyone(String permission, ComponentDto project) {
GroupPermissionDto dto = new GroupPermissionDto().setOrganizationUuid(project.getOrganizationUuid()).setGroupId(null).setRole(permission).setResourceId(project.getId());
db.getDbClient().groupPermissionDao().insert(db.getSession(), dto);
db.commit();
return dto;
}
use of org.sonar.db.permission.GroupPermissionDto in project sonarqube by SonarSource.
the class UserDbTester method insertPermissionOnAnyone.
// GROUP PERMISSIONS
public GroupPermissionDto insertPermissionOnAnyone(OrganizationDto org, String permission) {
GroupPermissionDto dto = new GroupPermissionDto().setOrganizationUuid(org.getUuid()).setGroupId(null).setRole(permission);
db.getDbClient().groupPermissionDao().insert(db.getSession(), dto);
db.commit();
return dto;
}
use of org.sonar.db.permission.GroupPermissionDto in project sonarqube by SonarSource.
the class GroupsAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
try (DbSession dbSession = dbClient.openSession(false)) {
OrganizationDto org = support.findOrganization(dbSession, request.param(PARAM_ORGANIZATION));
Optional<ProjectId> projectId = support.findProjectId(dbSession, request);
checkProjectAdmin(userSession, org.getUuid(), projectId);
PermissionQuery query = buildPermissionQuery(request, projectId);
// TODO validatePermission(groupsRequest.getPermission(), wsProjectRef);
List<GroupDto> groups = findGroups(dbSession, org, query);
int total = dbClient.groupPermissionDao().countGroupsByQuery(dbSession, org.getUuid(), query);
List<GroupPermissionDto> groupsWithPermission = findGroupPermissions(dbSession, org, groups, projectId);
Paging paging = Paging.forPageIndex(request.mandatoryParamAsInt(Param.PAGE)).withPageSize(query.getPageSize()).andTotal(total);
WsGroupsResponse groupsResponse = buildResponse(groups, groupsWithPermission, paging);
writeProtobuf(groupsResponse, request, response);
}
}
Aggregations