Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/26/18 08:51:30 (7 years ago)
Author:
jzenisek
Message:

#2839

  • worked on (restricted) accessibility of hive's administration area for non-admin roles
  • adapted HiveClient & HiveAdminClient entity loading (client- & service-side)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedProjectResourceDao.cs

    r15628 r15658  
    7777    public IEnumerable<Guid> GetAllGrantedResourceIdsByProjectId(Guid projectId) {
    7878      return DataContext.ExecuteQuery<Guid>(GetAllGrantedResourceIdsByProjectIdQueryString, projectId);
     79    }
     80
     81    public IEnumerable<Resource> GetAllGrantedResourcesByProjectIds(IEnumerable<Guid> projectIds) {
     82      string paramProjectIds = string.Join(",", projectIds.ToList().Select(x => string.Format("'{0}'", x)));
     83      if (!string.IsNullOrWhiteSpace(paramProjectIds)) {
     84        string queryString = string.Format(GetAllGrantedResourcesByProjectIdsQueryString, paramProjectIds);
     85        return DataContext.ExecuteQuery<Resource>(queryString);
     86      }
     87      return Enumerable.Empty<Resource>();
    7988    }
    8089
     
    173182    WHERE apr.ProjectId = '{0}'
    174183    ";
     184    private const string GetAllGrantedResourcesByProjectIdsQueryString = @"
     185      WITH rtree AS
     186      (
     187        SELECT ResourceId, ParentResourceId
     188        FROM [Resource]
     189        UNION ALL
     190        SELECT rt.ResourceId, r.ParentResourceId
     191        FROM [Resource] r
     192        JOIN rtree rt ON rt.ParentResourceId = r.ResourceId
     193      )
     194      SELECT res.*
     195      FROM rtree, [AssignedProjectResource] apr, [Resource] res
     196      WHERE rtree.ParentResourceId = apr.ResourceId
     197      AND rtree.ResourceId = res.ResourceId
     198      AND apr.ProjectId IN ({0})
     199      UNION
     200      SELECT res.*
     201      FROM [AssignedProjectResource] apr, [Resource] res
     202      WHERE apr.ResourceId = res.ResourceId
     203      AND apr.ProjectId IN ({0})
     204    ";
    175205    private const string GetAllGrantedResourceIdsOfOwnedParentProjectsQueryString = @"
    176206      WITH pbranch AS
Note: See TracChangeset for help on using the changeset viewer.