Changeset 2100
- Timestamp:
- 06/25/09 13:56:49 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Core/3.2/Authorization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/Authorization/HivePermissionManager.cs
r2093 r2100 41 41 /// <param name="entityID">Entity ID can be some resource or emtpy.</param> 42 42 public void Authorize(string policyName, Guid sessionID, Guid entityID) { 43 #region Use authorization method with scopes 43 44 //check if this policy has a permission with 'ANY' scope defined 44 45 Permission p = policyCollection[policyName].GetPermissionByContext("Any"); 45 46 46 //check if user has 'xxx.Any' permission 47 47 if (p != null) … … 59 59 //check if this policy has a permission with 'OWNER' scope defined 60 60 p = policyCollection[policyName].GetPermissionByContext("User"); 61 61 62 //check if user has 'xxx.Owner' permission 62 63 if (p != null) 63 64 if (CheckPermission(sessionID, p.Id, jobManager.GetJobById(entityID).Obj.UserId)) return; 64 65 #endregion 66 #region Use authorization method when no scopes are present 67 //when no permission context is available, use primary authentification 68 foreach (KeyValuePair<Permission, PermissionContext> item in policyCollection[policyName].Permissions) 69 { 70 if (CheckPermission(sessionID, item.Key.Id, Guid.Empty)) return; 71 } 72 #endregion 65 73 //throw an exception when user access fails 66 //throw new PermissionException(policyName);74 throw new PermissionException(policyName); 67 75 } 68 76 -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/Authorization/Policy.cs
r2065 r2100 28 28 return null; 29 29 } 30 30 31 } 31 32 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/Authorization/PolicyCollection.cs
r2065 r2100 3 3 using System.Linq; 4 4 using System.Text; 5 using System.Collections; 5 6 6 7 namespace HeuristicLab.Hive.Server.Core { … … 24 25 } 25 26 26 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { 27 return this._policies.GetEnumerator(); 27 #region IEnumerable Members 28 29 IEnumerator IEnumerable.GetEnumerator() 30 { 31 return this._policies.GetEnumerator(); 28 32 } 33 34 #endregion 29 35 } 30 36 }
Note: See TracChangeset
for help on using the changeset viewer.