public override bool IsSubsetOf(IPermission target) { if (target == null) { return(state == PermissionState.None && readList == null && writeList == null && createList == null); } else if (!(target is RegistryPermission)) { throw new ArgumentException(_("Arg_PermissionMismatch")); } else if (((RegistryPermission)target).IsUnrestricted()) { return(true); } else if (IsUnrestricted()) { return(false); } else { return(EnvironmentPermission.IsSubsetOf (readList, ((RegistryPermission)target).readList) && EnvironmentPermission.IsSubsetOf (writeList, ((RegistryPermission)target).writeList) && EnvironmentPermission.IsSubsetOf (createList, ((RegistryPermission)target).createList)); } }
public override bool IsSubsetOf(IPermission target) { if (target == null) { return(sites == null || sites.Length == 0); } else if (!(target is SiteIdentityPermission)) { throw new ArgumentException(_("Arg_PermissionMismatch")); } else { return(EnvironmentPermission.IsSubsetOf (sites, ((SiteIdentityPermission)target).sites)); } }
public override bool IsSubsetOf(IPermission target) { if (target == null) { return(state == PermissionState.None && readList == null && writeList == null && appendList == null && discoveryList == null); } else if (!(target is FileIOPermission)) { throw new ArgumentException(_("Arg_PermissionMismatch")); } else if (((FileIOPermission)target).IsUnrestricted()) { return(true); } else if (IsUnrestricted()) { return(false); } else { return(EnvironmentPermission.IsSubsetOf (readList, ((FileIOPermission)target).readList) && EnvironmentPermission.IsSubsetOf (writeList, ((FileIOPermission)target).writeList) && EnvironmentPermission.IsSubsetOf (appendList, ((FileIOPermission)target).appendList) && EnvironmentPermission.IsSubsetOf (discoveryList, ((FileIOPermission)target).discoveryList) && ((allLocalFiles & ((FileIOPermission)target).allLocalFiles) == allLocalFiles) && ((allFiles & ((FileIOPermission)target).allFiles) == allFiles)); } }
public void IsSubsetOfBadPermission () { EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables); FileDialogPermission fdp2 = new FileDialogPermission (PermissionState.Unrestricted); Assert ("IsSubsetOf(FileDialogPermission)", ep1.IsSubsetOf (fdp2)); }
public void IsSubsetOf () { EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Write, envVariables); EnvironmentPermission ep2 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables); Assert ("IsSubsetOf(nosubset1)", !ep1.IsSubsetOf (ep2)); Assert ("IsSubsetOf(nosubset2)", !ep2.IsSubsetOf (ep1)); EnvironmentPermission ep3 = new EnvironmentPermission (EnvironmentPermissionAccess.Write, "TMP"); Assert ("IsSubsetOf(TMP)", !ep1.IsSubsetOf (ep3)); Assert ("TMP.IsSubsetOf()", ep3.IsSubsetOf (ep1)); }
public void IsSubsetOfUnrestricted () { EnvironmentPermission ep1 = new EnvironmentPermission (PermissionState.Unrestricted); EnvironmentPermission ep2 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables); EnvironmentPermission ep3 = new EnvironmentPermission (PermissionState.Unrestricted); Assert ("Unrestricted.IsSubsetOf()", !ep1.IsSubsetOf (ep2)); Assert ("IsSubsetOf(Unrestricted)", ep2.IsSubsetOf (ep1)); Assert ("Unrestricted.IsSubsetOf(Unrestricted)", ep1.IsSubsetOf (ep3)); }
public void IsSubsetOfNull () { EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables); Assert ("IsSubsetOf(null)", !ep1.IsSubsetOf (null)); }