当前位置: 首页>>代码示例>>C#>>正文


C# Policy.PolicyLevel类代码示例

本文整理汇总了C#中System.Security.Policy.PolicyLevel的典型用法代码示例。如果您正苦于以下问题:C# PolicyLevel类的具体用法?C# PolicyLevel怎么用?C# PolicyLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PolicyLevel类属于System.Security.Policy命名空间,在下文中一共展示了PolicyLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromXml

		public void FromXml (SecurityElement e, PolicyLevel level)
		{
			MembershipConditionHelper.CheckSecurityElement (e, "e", version, version);
			if (!Boolean.TryParse (e.Attribute ("LookAtDir"), out _lookAtDir))
				_lookAtDir = false;
			// PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:ApplicationMembershipCondition.cs

示例2: ToXml

 public SecurityElement ToXml(PolicyLevel level)
 {
     SecurityElement element = new SecurityElement("IMembershipCondition");
     XMLUtil.AddClassAttribute(element, base.GetType(), "System.Security.Policy.AllMembershipCondition");
     element.AddAttribute("version", "1");
     return element;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AllMembershipCondition.cs

示例3: CreateAppDomain

        public AppDomain CreateAppDomain( PolicyLevel policyLevel )
        {
            var domain = AppDomain.CreateDomain( "medium", AppDomain.CurrentDomain.Evidence );

            domain.SetAppDomainPolicy( policyLevel );
            return domain;
        }
开发者ID:chKarner,项目名称:innovatian.configuration,代码行数:7,代码来源:MediumTrustContext.cs

示例4: ToXml

 public SecurityElement ToXml( PolicyLevel level )
 {
     SecurityElement root = new SecurityElement( "IMembershipCondition" );
     System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), this.GetType().FullName );
     root.AddAttribute( "version", "1" );
     return root;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:GACMembershipCondition.cs

示例5: FromXml

        public void FromXml( SecurityElement e, PolicyLevel level )
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (!e.Tag.Equals( "IMembershipCondition" ))
                throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:gacmembershipcondition.cs

示例6: ListPermissionSets

 private static void ListPermissionSets(PolicyLevel pLevel)
 {
     IList namedPermissions = pLevel.NamedPermissionSets;
     IEnumerator namedPermission = namedPermissions.GetEnumerator();
     while (namedPermission.MoveNext())
     {
         Console.WriteLine("\t" + ((NamedPermissionSet)namedPermission.Current).Name);
     }
 }
开发者ID:oblivious,项目名称:Oblivious,代码行数:9,代码来源:Program.cs

示例7: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.AllMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            Contract.Assert( this.GetType().FullName.Equals( "System.Security.Policy.AllMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            return root;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:AllMembershipCondition.cs

示例8: ParseXml

 protected override void ParseXml(SecurityElement e, PolicyLevel level)
 {
     string str = e.Attribute("Access");
     if (str != null)
     {
         this.m_access = (FileIOPermissionAccess) Enum.Parse(typeof(FileIOPermissionAccess), str);
     }
     else
     {
         this.m_access = FileIOPermissionAccess.NoAccess;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:FileCodeGroup.cs

示例9: FromXml

 public void FromXml(SecurityElement e, PolicyLevel level)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (!e.Tag.Equals("IMembershipCondition"))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MembershipConditionElement"));
     }
     lock (this)
     {
         this.m_zone = System.Security.SecurityZone.NoZone;
         this.m_element = e;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:ZoneMembershipCondition.cs

示例10: FromXml

		public void FromXml (SecurityElement e, PolicyLevel level)
		{
			_se = e;
		}
开发者ID:Anjoli,项目名称:mono,代码行数:4,代码来源:caspol.cs

示例11: FindCodeGroup

		static CodeGroup FindCodeGroup (string name, ref CodeGroup parent, ref PolicyLevel pl)
		{
			if (name.Length < 1)
				return null;
			
			// Notes:
			// - labels starts with numbers (e.g. 1.2.1)
			// - names cannot start with numbers (A-Z, 0-9 and _)
			bool label = Char.IsDigit (name, 0);

			// More notes
			// - we can't remove the root code group
			// - we remove only one group (e.g. name)
			for (int i=0; i < Levels.Count; i++) {
				pl = (PolicyLevel) Levels [i];
				parent = pl.RootCodeGroup;
				CodeGroup cg = null;
				if (label)
					cg = FindCodeGroupByLabel (name, "1", ref parent);
				else
					cg = FindCodeGroupByName (name, ref parent);
				
				if (cg != null)
					return cg;
			}
			Console.WriteLine ("CodeGroup with {0} '{1}' was not found!",
				label ? "label" : "name", name);
			return null;
		}
开发者ID:Anjoli,项目名称:mono,代码行数:29,代码来源:caspol.cs

示例12: ShowResolveGroup

		static void ShowResolveGroup (PolicyLevel pl, Evidence e)
		{
			Console.WriteLine ("{0}Level: {1}{0}", Environment.NewLine, pl.Label);
			CodeGroup cg = pl.ResolveMatchingCodeGroups (e);
			Console.WriteLine ("Code Groups:{0}", Environment.NewLine);
			ShowCodeGroup (cg, "1");
			Console.WriteLine ();
		}
开发者ID:Anjoli,项目名称:mono,代码行数:8,代码来源:caspol.cs

示例13: ResolvePolicyLevel

		internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence)
		{
			PolicyStatement pst = pl.Resolve (evidence);
			if (pst != null) {
				if (ps == null) {
					// only for initial (first) policy level processed
					ps = pst.PermissionSet;
				} else {
					ps = ps.Intersect (pst.PermissionSet);
					if (ps == null) {
						// null is equals to None - exist that null can throw NullReferenceException ;-)
						ps = new PermissionSet (PermissionState.None);
					}
				}

				if ((pst.Attributes & PolicyStatementAttribute.LevelFinal) == PolicyStatementAttribute.LevelFinal)
					return true;
			}
			return false;
		}
开发者ID:shana,项目名称:mono,代码行数:20,代码来源:SecurityManager.cs

示例14: InitializePolicyHierarchy

		private static void InitializePolicyHierarchy ()
		{
			string machinePolicyPath = Path.GetDirectoryName (Environment.GetMachineConfigPath ());
			// note: use InternalGetFolderPath to avoid recursive policy initialization
			string userPolicyPath = Path.Combine (Environment.UnixGetFolderPath (Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create), "mono");

			PolicyLevel enterprise = new PolicyLevel ("Enterprise", PolicyLevelType.Enterprise);
			_level = enterprise;
			enterprise.LoadFromFile (Path.Combine (machinePolicyPath, "enterprisesec.config"));

			PolicyLevel machine = new PolicyLevel ("Machine", PolicyLevelType.Machine);
			_level = machine;
			machine.LoadFromFile (Path.Combine (machinePolicyPath, "security.config"));

			PolicyLevel user = new PolicyLevel ("User", PolicyLevelType.User);
			_level = user;
			user.LoadFromFile (Path.Combine (userPolicyPath, "security.config"));

			ArrayList al = new ArrayList ();
			al.Add (enterprise);
			al.Add (machine);
			al.Add (user);

			_hierarchy = ArrayList.Synchronized (al);
			_level = null;
		}
开发者ID:shana,项目名称:mono,代码行数:26,代码来源:SecurityManager.cs

示例15: SavePolicyLevel

		public static void SavePolicyLevel (PolicyLevel level) 
		{
			// Yes this will throw a NullReferenceException, just like MS (see FDBK13121)
			level.Save ();
		}
开发者ID:shana,项目名称:mono,代码行数:5,代码来源:SecurityManager.cs


注:本文中的System.Security.Policy.PolicyLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。