Changeset 6743 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs
- Timestamp:
- 09/12/11 18:04:25 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs
r6717 r6743 33 33 } 34 34 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 35 43 public void AuthorizeForJob(Guid jobId, DT.Permission requiredPermission) { 36 if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all jobs37 38 44 Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForJob(jobId, ServiceLocator.Instance.UserManager.CurrentUserId); 39 45 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"); 47 47 } 48 48 }
Note: See TracChangeset
for help on using the changeset viewer.