Last change
on this file since 2100 was
2100,
checked in by mbecirov, 15 years ago
|
#586: Fixed authorization when no policy scope is defined.
|
File size:
1.0 KB
|
Rev | Line | |
---|
[2065] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Security.Contracts.BusinessObjects;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Hive.Server.Core {
|
---|
| 8 | public class Policy {
|
---|
| 9 | private string _name;
|
---|
| 10 | public string Name { get { return _name; } set { this._name = value; } }
|
---|
| 11 |
|
---|
| 12 | private IDictionary<Permission, PermissionContext> _permissions = new Dictionary<Permission, PermissionContext>();
|
---|
| 13 | public IDictionary<Permission, PermissionContext> Permissions { get { return this._permissions; } set { this._permissions = value; } }
|
---|
| 14 |
|
---|
| 15 | public Policy(string name) {
|
---|
| 16 | this._name = name;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | public void AddPermission(Permission permission, PermissionContext ctx) {
|
---|
| 20 | this._permissions.Add(permission, ctx);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | public Permission GetPermissionByContext(string context) {
|
---|
| 24 | foreach (KeyValuePair<Permission, PermissionContext> item in _permissions) {
|
---|
| 25 | if (item.Value.Elevation == context)
|
---|
| 26 | return item.Key;
|
---|
| 27 | }
|
---|
| 28 | return null;
|
---|
| 29 | }
|
---|
[2100] | 30 |
|
---|
[2065] | 31 | }
|
---|
| 32 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.