Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Authorization/AuthorizationManager.cs @ 4423

Last change on this file since 4423 was 4423, checked in by cneumuel, 14 years ago
  • Refactored HL.Hive.Experiment. JobItems are not called HiveJobs and OptimizerJobs do not contain a hierarchy anymore.
  • Dynamic generation of jobs on a slave are not reflected on the client user interface.
  • Optimizer-Trees are now strictly synchronized with the HiveJob-Trees (also the ComputeInParallel property is taken into account when the Child HiveJobs are created)
  • Improved the way a class can report progress and lock the UI (IProgressReporter, IProgress, Progress, ProgressView)
  • Changes were made to the config-files, so that server and clients work with blade12.hpc.fh-hagenberg.at
  • Lots of small changes and bugfixes
File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Security.Principal;
6using System.ServiceModel;
7using System.Threading;
8using System.Security;
9using HeuristicLab.Hive.Server.DataAccess;
10using HeuristicLab.Hive.Server.Core.InternalInterfaces;
11using System.Web.Security;
12
13namespace HeuristicLab.Hive.Server.Core.Authorization {
14  public class AuthorizationManager : IAuthorizationManager {
15    private MembershipUser Identity {
16      get { return Membership.GetUser(); }
17    }
18
19    public Guid UserId {
20      get { return (Guid)Identity.ProviderUserKey; }
21    }
22
23    public void AuthorizeJobs(params Guid[] jobIds) {
24      if (!IsAuthorizedForJobs(jobIds)) {
25        throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access job (Id: " + string.Join(", ", jobIds.Select(x => x.ToString()).ToArray()) + ")");
26      }
27    }
28   
29    private bool IsAuthorizedForJobs(params Guid[] jobIds) {
30      return DaoLocator.JobDao.IsUserAuthorizedForJobs(UserId, jobIds);
31    }
32
33    public void Authorize(Guid userId) {
34      if (userId != this.UserId) {
35        throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access object");
36      }
37    }
38  }
39}
Note: See TracBrowser for help on using the repository browser.