Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/25/17 17:20:15 (7 years ago)
Author:
jkarder
Message:

#2839: worked on Project and ProjectPermission service methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs

    r14185 r15380  
    8181    }
    8282
     83    public void AuthorizeForProjectAdministration(Guid projectId) {
     84      var pm = PersistenceManager;
     85      var projectDao = pm.ProjectDao;
     86      pm.UseTransaction(() => {
     87        var project = projectDao.GetById(projectId);
     88        if (project == null) throw new SecurityException(NOT_AUTHORIZED);
     89        if (project.OwnerUserId != UserManager.CurrentUserId
     90            && !RoleVerifier.IsInRole(HiveRoles.Administrator)) {
     91          throw new SecurityException(NOT_AUTHORIZED);
     92        }
     93      });
     94    }
     95
    8396    private DA.Permission GetPermissionForJob(IPersistenceManager pm, Guid jobId, Guid userId) {
    8497      var jobDao = pm.JobDao;
Note: See TracChangeset for help on using the changeset viewer.