System.Security.SecurityManager.SecurityManager.IsGranted C# (CSharp) Method

IsGranted() public static method

public static IsGranted ( IPermission perm ) : bool
perm IPermission
return bool
		public static bool IsGranted (IPermission perm)
		{
			if (perm == null)
				return true;
			if (!SecurityEnabled)
				return true;

			// - Policy driven
			// - Only check the caller (no stack walk required)
			// - Not affected by overrides (like Assert, Deny and PermitOnly)
			// - calls IsSubsetOf even for non CAS permissions
			//   (i.e. it does call Demand so any code there won't be executed)
#if NET_2_0
			// with 2.0 identity permission are unrestrictable
			return IsGranted (Assembly.GetCallingAssembly (), perm);
#else
			if (perm is IUnrestrictedPermission)
				return IsGranted (Assembly.GetCallingAssembly (), perm);
			else
				return IsGrantedRestricted (Assembly.GetCallingAssembly (), perm);
#endif
		}

Same methods

SecurityManager.SecurityManager::IsGranted ( Assembly a, IPermission perm ) : bool