Csharp/C Sharp by API/System.Security/SecurityManager
SecurityManager.CheckExecutionRights
using System.Security;
class MainClass {
public static void Main() {
SecurityManager.CheckExecutionRights = true;
SecurityManager.SavePolicy();
SecurityManager.CheckExecutionRights = false;
SecurityManager.SavePolicy();
}
}
SecurityManager.PolicyHierarchy()
using System;
using System.Security.Policy;
using System.Security;
using System.Collections;
class Class1 {
static void Main() {
IEnumerator PolicyEnum = SecurityManager.PolicyHierarchy();
while (PolicyEnum.MoveNext()) {
PolicyLevel levelPolicy = (PolicyLevel)PolicyEnum.Current;
Console.WriteLine(levelPolicy.Label);
IEnumerator PermissionEnum = levelPolicy.NamedPermissionSets.GetEnumerator();
while (PermissionEnum.MoveNext()) {
NamedPermissionSet permissionSet = (NamedPermissionSet)PermissionEnum.Current;
Console.WriteLine("\tPermission Set: \n\t\t Name: {0} \n\t\t Description {1}", permissionSet.Name, permissionSet.Description);
}
}
}
}
SecurityManager.SavePolicy()
using System.Security;
class MainClass {
public static void Main() {
SecurityManager.CheckExecutionRights = true;
SecurityManager.SavePolicy();
SecurityManager.CheckExecutionRights = false;
SecurityManager.SavePolicy();
}
}