Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/12 12:06:18 (12 years ago)
Author:
jkarder
Message:

#1859: manually merged branch "HiveResourcePermissionManagement (trunk integration)" into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs

    r7259 r8051  
    3434
    3535    public void AuthorizeForTask(Guid taskId, DT.Permission requiredPermission) {
    36       if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all tasks
     36      if (ServiceLocator.Instance.RoleVerifier.IsInRole(HiveRoles.Slave)) return; // slave-users can access all tasks
    3737
    3838      Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForTask(taskId, ServiceLocator.Instance.UserManager.CurrentUserId);
     
    4646        throw new SecurityException("Current user is not authorized to access task");
    4747    }
     48
     49    public void AuthorizeForResourceAdministration(Guid resourceId) {
     50      Resource resource = DT.Convert.ToEntity(ServiceLocator.Instance.HiveDao.GetResource(resourceId));
     51      if (resource.OwnerUserId != ServiceLocator.Instance.UserManager.CurrentUserId && !ServiceLocator.Instance.RoleVerifier.IsInRole(HiveRoles.Administrator))
     52        throw new SecurityException("Current user is not authorized to access resource");
     53    }
    4854  }
    4955}
Note: See TracChangeset for help on using the changeset viewer.