Example #1
0
        public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            if (!this.AccessRuleType.IsAssignableFrom(rule.GetType()))
            {
                throw new ArgumentException(
                          Environment.GetResourceString("AccessControl_InvalidAccessRuleType"),
                          "rule");
            }
            Contract.EndContractBlock();

            WriteLock();

            try
            {
                return(ModifyAccess(modification, rule, out modified));
            }
            finally
            {
                WriteUnlock();
            }
        }
Example #2
0
        public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if (rule == null)
            {
                throw new ArgumentNullException(nameof(rule));
            }

            if (!this.AccessRuleType.GetTypeInfo().IsAssignableFrom(rule.GetType().GetTypeInfo()))
            {
                throw new ArgumentException(
                          SR.AccessControl_InvalidAccessRuleType,
                          nameof(rule));
            }

            WriteLock();

            try
            {
                return(ModifyAccess(modification, rule, out modified));
            }
            finally
            {
                WriteUnlock();
            }
        }
 /// <summary>将指定修改应用于与此 <see cref="T:System.Security.AccessControl.DirectoryObjectSecurity" /> 对象关联的自由访问控制列表 (DACL)。</summary>
 /// <returns>如果成功修改了 DACL,则为 true;否则为 false。</returns>
 /// <param name="modification">要应用于 DACL 的修改。</param>
 /// <param name="rule">要修改的访问规则。</param>
 /// <param name="modified">如果成功修改了 DACL,则为 true;否则为 false。</param>
 protected override bool ModifyAccess(AccessControlModification modification, AccessRule rule, out bool modified)
 {
     if (!this.AccessRuleType.IsAssignableFrom(rule.GetType()))
     {
         throw new ArgumentException(Environment.GetResourceString("AccessControl_InvalidAccessRuleType"), "rule");
     }
     return(this.ModifyAccess(modification, rule as ObjectAccessRule, out modified));
 }
        public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            if (!AccessRuleType.IsAssignableFrom(rule.GetType()))
            {
                throw new ArgumentException("rule");
            }

            return(ModifyAccess(modification, rule, out modified));
        }
Example #5
0
        public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if ( rule == null )
            {
                throw new ArgumentNullException( nameof(rule));
            }

            if ( !this.AccessRuleType.GetTypeInfo().IsAssignableFrom(rule.GetType().GetTypeInfo()) )
            {
                throw new ArgumentException(
                    SR.AccessControl_InvalidAccessRuleType, 
nameof(rule));
            }
            Contract.EndContractBlock();

            WriteLock();

            try
            {
                return ModifyAccess(modification, rule, out modified);
            }
            finally
            {
                WriteUnlock();
            }
        }
Example #6
0
        public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if ( rule == null )
            {
                throw new ArgumentNullException( "rule" );
            }

            if ( !this.AccessRuleType.IsAssignableFrom(rule.GetType()) )
            {
                throw new ArgumentException(
                    Environment.GetResourceString("AccessControl_InvalidAccessRuleType"), 
                    "rule");
            }
            Contract.EndContractBlock();

            WriteLock();

            try
            {
                return ModifyAccess(modification, rule, out modified);
            }
            finally
            {
                WriteUnlock();
            }
        }
 protected override bool ModifyAccess(AccessControlModification modification, AccessRule rule, out bool modified)
 {
     if ( !this.AccessRuleType.IsAssignableFrom(rule.GetType()) )
     {
         throw new ArgumentException(
             Environment.GetResourceString("AccessControl_InvalidAccessRuleType"), 
             "rule");
     }
     Contract.EndContractBlock();
     return ModifyAccess(modification, rule as ObjectAccessRule, out modified);
 }
Example #8
0
		public virtual bool ModifyAccessRule (AccessControlModification modification, AccessRule rule, out bool modified)
		{
			if (rule == null)
				throw new ArgumentNullException ("rule");
				
			if (!AccessRuleType.IsAssignableFrom (rule.GetType()))
				throw new ArgumentException ("rule");

			return ModifyAccess (modification, rule, out modified);
		}