System.Security.PermissionSet.IsSubsetOf C# (CSharp) Method

IsSubsetOf() public method

public IsSubsetOf ( PermissionSet target ) : bool
target PermissionSet
return bool
        public bool IsSubsetOf(PermissionSet target) { return false; }
        public bool IsUnrestricted() { return false; }

Same methods

PermissionSet::IsSubsetOf ( System target ) : bool

Usage Example

	// Determine if a specific permission has been granted.
	public static bool IsGranted(IPermission perm)
			{
				// Bail out if the requested permission is null.
				if(perm == null)
				{
					return true;
				}

				// Get the current permission state.
				ClrPermissions current = ClrSecurity.GetPermissionsFrom(1);
				if(current == null)
				{
					// Null is equivalent to "unrestricted".
					return true;
				}

				// Build a permission set with just this permission.
				PermissionSet set = new PermissionSet(PermissionState.None);
				set.AddPermission(perm);

				// If "PermitOnly" is set, then only check that set.
				if(current.permitOnly != null)
				{
					return set.IsSubsetOf(current.permitOnly);
				}

				// The permission must be granted, but not denied.
				if(!set.IsSubsetOf(current.granted) ||
				   set.IsSubsetOf(current.denied))
				{
					return false;
				}
				return true;
			}
All Usage Examples Of System.Security.PermissionSet::IsSubsetOf