15 public static class CslaPolicy
17 private static string PolicyPrefix =
"Csla:";
25 public static string GetPolicy(Rules.AuthorizationActions action, Type objectType)
27 var actionName = action.ToString();
28 var typeName = objectType.AssemblyQualifiedName;
29 return $
"{PolicyPrefix}{actionName}|{typeName}";
39 public static bool TryGetPermissionRequirement(
string policy, out CslaPermissionRequirement requirement)
41 if (policy.StartsWith(PolicyPrefix))
43 var parts = policy.Substring(PolicyPrefix.Length).Split(
'|');
44 var action = (Rules.AuthorizationActions)Enum.Parse(typeof(Rules.AuthorizationActions), parts[0]);
45 var type = Type.GetType(parts[1]);
46 requirement =
new CslaPermissionRequirement(action, type);