IsSubsetOf() public method

public IsSubsetOf ( IPermission target ) : bool
target IPermission
return bool
コード例 #1
0
ファイル: RegistryPermission.cs プロジェクト: ForNeVeR/pnet
 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));
     }
 }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
ファイル: FileIOPermission.cs プロジェクト: ForNeVeR/pnet
 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));
     }
 }
コード例 #4
0
		public void IsSubsetOfBadPermission () 
		{
			EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
			FileDialogPermission fdp2 = new FileDialogPermission (PermissionState.Unrestricted);
			Assert ("IsSubsetOf(FileDialogPermission)", ep1.IsSubsetOf (fdp2));
		}
コード例 #5
0
		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));
		}
コード例 #6
0
		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));
		}
コード例 #7
0
		public void IsSubsetOfNull () 
		{
			EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
			Assert ("IsSubsetOf(null)", !ep1.IsSubsetOf (null));
		}