Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16203


Ignore:
Timestamp:
10/01/18 15:18:23 (6 years ago)
Author:
jzenisek
Message:

#2839: fixed job listing method for hive administrators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r16187 r16203  
    355355        return pm.UseTransaction(() => {
    356356          // check if user is granted to administer the requested projectId
    357           var administrationGrantedProjects = projectDao
    358             .GetAdministrationGrantedProjectsForUser(currentUserId)
    359             .ToList();
     357          bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator);
     358          List<DA.Project> administrationGrantedProjects;
     359          if (isAdmin) {
     360            administrationGrantedProjects = projectDao.GetAll().ToList();
     361          } else {
     362            administrationGrantedProjects = projectDao
     363              .GetAdministrationGrantedProjectsForUser(currentUserId)             
     364              .ToList();
     365          }
    360366
    361367          if (administrationGrantedProjects.Select(x => x.ProjectId).Contains(projectId)) {
     
    382388        return pm.UseTransaction(() => {
    383389          // check for which of requested projectIds the user is granted to administer
    384           var administrationGrantedProjectIds = projectDao
    385             .GetAdministrationGrantedProjectsForUser(currentUserId)
    386             .Select(x => x.ProjectId)
    387             .ToList();
     390          bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator);
     391          List<Guid> administrationGrantedProjectIds;
     392          if (isAdmin) {
     393            administrationGrantedProjectIds = projectDao.GetAll().Select(x => x.ProjectId).ToList();
     394          } else {
     395            administrationGrantedProjectIds = projectDao
     396              .GetAdministrationGrantedProjectsForUser(currentUserId)
     397              .Select(x => x.ProjectId)
     398              .ToList();
     399          }
    388400          var requestedAndGrantedProjectIds = projectIds.Intersect(administrationGrantedProjectIds);
    389401
Note: See TracChangeset for help on using the changeset viewer.