Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/17 11:27:33 (5 years ago)
Author:
jzenisek
Message:

#2839 worked on permission checks in listing methods

File:
1 edited

Legend:

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

    r15540 r15552  
    3131    public override Project GetById(Guid id) {
    3232      return GetByIdQuery(DataContext, id);
     33    }
     34
     35    public IEnumerable<Project> GetGrantedProjectsForUser(IEnumerable<Guid> userAndGroupIds) {
     36      return GetGrantedProjectsForUserQuery(DataContext, userAndGroupIds);
    3337    }
    3438
     
    6367         where project.ProjectId == projectId
    6468         select project).SingleOrDefault());
     69    private static readonly Func<DataContext, IEnumerable<Guid>, IEnumerable<Project>> GetGrantedProjectsForUserQuery =
     70      CompiledQuery.Compile((DataContext db, IEnumerable<Guid> userAndGroupIds) =>
     71      (from project in db.GetTable<Project>()
     72       join projectPermission in db.GetTable<ProjectPermission>()
     73       on project.ProjectId equals projectPermission.ProjectId
     74       where userAndGroupIds.Contains(projectPermission.GrantedUserId)
     75       select project).Distinct());
    6576    #endregion
    6677
    67     #region String queries
     78      #region String queries
    6879    private const string GetChildProjectsByIdQuery = @"
    6980      WITH ptree AS
Note: See TracChangeset for help on using the changeset viewer.