// // Utility methods to construct the permission set objects from the well known XML and any permission // set extensions if necessary // private static NamedPermissionSet GetOrDeserializeExtendablePermissionSet(ref NamedPermissionSet permissionSet, string permissionSetXml #if FEATURE_CAS_POLICY , string extensionXml #endif // FEATURE_CAS_POLICY ) { Contract.Requires(!String.IsNullOrEmpty(permissionSetXml)); #if FEATURE_CAS_POLICY Contract.Requires(!String.IsNullOrEmpty(extensionXml)); #endif // FEATURE_CAS_POLICY if (permissionSet == null) { #if FEATURE_CAS_POLICY SecurityElement securityElement = SecurityElement.FromString(permissionSetXml); NamedPermissionSet deserializedPermissionSet = new NamedPermissionSet(securityElement); PermissionSet extensions = GetPermissionSetExtensions(extensionXml); deserializedPermissionSet.InplaceUnion(extensions); permissionSet = deserializedPermissionSet; #endif // FEATURE_CAS_POLICY } return(permissionSet.Copy() as NamedPermissionSet); }
private static NamedPermissionSet GetOrDeserializeExtendablePermissionSet(ref NamedPermissionSet permissionSet, string permissionSetXml, string extensionXml) { if (permissionSet == null) { NamedPermissionSet namedPermissionSet = new NamedPermissionSet(SecurityElement.FromString(permissionSetXml)); PermissionSet permissionSetExtensions = BuiltInPermissionSets.GetPermissionSetExtensions(extensionXml); namedPermissionSet.InplaceUnion(permissionSetExtensions); permissionSet = namedPermissionSet; } return(permissionSet.Copy() as NamedPermissionSet); }
// // Utility methods to construct the permission set objects from the well known XML and any permission // set extensions if necessary // private static NamedPermissionSet GetOrDeserializeExtendablePermissionSet(ref NamedPermissionSet permissionSet, string permissionSetXml #if FEATURE_CAS_POLICY ,string extensionXml #endif // FEATURE_CAS_POLICY ) { Contract.Requires(!String.IsNullOrEmpty(permissionSetXml)); #if FEATURE_CAS_POLICY Contract.Requires(!String.IsNullOrEmpty(extensionXml)); #endif // FEATURE_CAS_POLICY if (permissionSet == null) { #if FEATURE_CAS_POLICY SecurityElement securityElement = SecurityElement.FromString(permissionSetXml); NamedPermissionSet deserializedPermissionSet = new NamedPermissionSet(securityElement); PermissionSet extensions = GetPermissionSetExtensions(extensionXml); deserializedPermissionSet.InplaceUnion(extensions); permissionSet = deserializedPermissionSet; #endif // FEATURE_CAS_POLICY } return permissionSet.Copy() as NamedPermissionSet; }