Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/12/11 18:04:25 (13 years ago)
Author:
ascheibe
Message:

#1233

  • fixed a bug in the Slave UI
  • finished renaming Webservice and Dao methods to be consistent with Job/Task naming
  • some cosmetic changes and project dependencies cleanups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs

    r6717 r6743  
    3333    }
    3434
     35    public void AuthorizeForTask(Guid taskId, DT.Permission requiredPermission) {
     36      if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all tasks
     37
     38      Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForTask(taskId, ServiceLocator.Instance.UserManager.CurrentUserId);
     39      if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full))
     40        throw new SecurityException("Current user is not authorized to access task");
     41    }
     42
    3543    public void AuthorizeForJob(Guid jobId, DT.Permission requiredPermission) {
    36       if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all jobs
    37 
    3844      Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForJob(jobId, ServiceLocator.Instance.UserManager.CurrentUserId);
    3945      if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full))
    40         throw new SecurityException("Current user is not authorized to access job");
    41     }
    42 
    43     public void AuthorizeForExperiment(Guid experimentId, DT.Permission requiredPermission) {
    44       Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForExperiment(experimentId, ServiceLocator.Instance.UserManager.CurrentUserId);
    45       if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full))
    46         throw new SecurityException("Current user is not authorized to access experiment");
     46        throw new SecurityException("Current user is not authorized to access task");
    4747    }
    4848  }
Note: See TracChangeset for help on using the changeset viewer.