Search in sources :

Example 1 with OrganizationPermission

use of org.sonar.db.permission.OrganizationPermission in project sonarqube by SonarSource.

the class SearchGlobalPermissionsAction method buildResponse.

private WsSearchGlobalPermissionsResponse buildResponse(DbSession dbSession, OrganizationDto org) {
    WsSearchGlobalPermissionsResponse.Builder response = WsSearchGlobalPermissionsResponse.newBuilder();
    Permission.Builder permission = newBuilder();
    OrganizationPermission.all().map(OrganizationPermission::getKey).forEach(permissionKey -> {
        PermissionQuery query = permissionQuery(permissionKey);
        response.addPermissions(permission.clear().setKey(permissionKey).setName(i18nName(permissionKey)).setDescription(i18nDescriptionMessage(permissionKey)).setUsersCount(countUsers(dbSession, org, query)).setGroupsCount(countGroups(dbSession, org, permissionKey)));
    });
    return response.build();
}
Also used : WsSearchGlobalPermissionsResponse(org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse) OrganizationPermission(org.sonar.db.permission.OrganizationPermission) Permission(org.sonarqube.ws.WsPermissions.Permission) PermissionQuery(org.sonar.db.permission.PermissionQuery)

Aggregations

OrganizationPermission (org.sonar.db.permission.OrganizationPermission)1 PermissionQuery (org.sonar.db.permission.PermissionQuery)1 Permission (org.sonarqube.ws.WsPermissions.Permission)1 WsSearchGlobalPermissionsResponse (org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse)1