• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AccessControlModification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ModifyAccessRule

 public override bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
 {
     if (!this.DaclRetrieved())
     {
         throw new InvalidOperationException(Res.GetString("CannotModifyDacl"));
     }
     return base.ModifyAccessRule(modification, rule, out modified);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ActiveDirectorySecurity.cs


示例2: ModifyAccessRule

    public virtual new bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
    {
      Contract.Requires(this.AccessRuleType != null);

      modified = default(bool);

      return default(bool);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.Security.AccessControl.ObjectSecurity.cs


示例3: SetFolderACL

 public static bool SetFolderACL(String FolderPath, String UserName, FileSystemRights Rights, AccessControlType AllowOrDeny, InheritanceFlags Inherits, PropagationFlags PropagateToChildren, AccessControlModification AddResetOrRemove)
 {
     bool ret;
     DirectoryInfo folder = new DirectoryInfo(FolderPath);
     DirectorySecurity dSecurity = folder.GetAccessControl(AccessControlSections.All);
     FileSystemAccessRule accRule = new FileSystemAccessRule(UserName, Rights, Inherits, PropagateToChildren, AllowOrDeny); dSecurity.ModifyAccessRule(AddResetOrRemove, accRule, out ret);
     folder.SetAccessControl(dSecurity);
     return ret;
 }
开发者ID:AllanHao,项目名称:MotivationManager,代码行数:9,代码来源:Program.cs


示例4: ModifyAudit

        protected override bool ModifyAudit(AccessControlModification modification, AuditRule rule, out bool modified)
        {
            bool flag2;
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            base.WriteLock();
            try
            {
                bool flag = true;
                if (base._securityDescriptor.SystemAcl == null)
                {
                    if (((modification == AccessControlModification.Remove) || (modification == AccessControlModification.RemoveAll)) || (modification == AccessControlModification.RemoveSpecific))
                    {
                        modified = false;
                        return flag;
                    }
                    base._securityDescriptor.SystemAcl = new SystemAcl(base.IsContainer, base.IsDS, GenericAcl.AclRevision, 1);
                    base._securityDescriptor.AddControlFlags(ControlFlags.SystemAclPresent);
                }
                SecurityIdentifier sid = rule.IdentityReference.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier;
                switch (modification)
                {
                    case AccessControlModification.Add:
                        base._securityDescriptor.SystemAcl.AddAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags);
                        break;

                    case AccessControlModification.Set:
                        base._securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags);
                        break;

                    case AccessControlModification.Reset:
                        base._securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags);
                        break;

                    case AccessControlModification.Remove:
                        flag = base._securityDescriptor.SystemAcl.RemoveAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags);
                        break;

                    case AccessControlModification.RemoveAll:
                        flag = base._securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None);
                        if (!flag)
                        {
                            throw new InvalidProgramException();
                        }
                        break;

                    case AccessControlModification.RemoveSpecific:
                        base._securityDescriptor.SystemAcl.RemoveAuditSpecific(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("modification", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
                }
                modified = flag;
                base.AuditRulesModified |= modified;
                flag2 = flag;
            }
            finally
            {
                base.WriteUnlock();
            }
            return flag2;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:65,代码来源:CommonObjectSecurity.cs


示例5: ModifyAudit

 protected abstract bool ModifyAudit(AccessControlModification modification, AuditRule rule, out bool modified);
开发者ID:scott156,项目名称:corefx-progress,代码行数:1,代码来源:System.Security.AccessControl.cs


示例6: ModifyAuditRule

        public virtual bool ModifyAuditRule(AccessControlModification modification, AuditRule rule, out bool modified)
        {
            if ( rule == null )
            {
                throw new ArgumentNullException( nameof(rule));
            }

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

            WriteLock();

            try
            {
                return ModifyAudit(modification, rule, out modified);
            }
            finally
            {
                WriteUnlock();
            }
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:26,代码来源:ObjectSecurity.cs


示例7: ModifyAudit

        //
        // Modifies the SACL
        //
        private bool ModifyAudit(AccessControlModification modification, ObjectAuditRule rule, out bool modified)
        {
            bool result = true;

            if (_securityDescriptor.SystemAcl == null)
            {
                if (modification == AccessControlModification.Remove || modification == AccessControlModification.RemoveAll || modification == AccessControlModification.RemoveSpecific)
                {
                    modified = false;
                    return result;
                }

                //_securityDescriptor.SystemAcl = new SystemAcl(IsContainer, IsDS, GenericAcl.AclRevisionDS, 1);
                //_securityDescriptor.AddControlFlags(ControlFlags.SystemAclPresent);
                _securityDescriptor.AddSystemAcl(GenericAcl.AclRevisionDS, 1);
            }
            else if ((modification == AccessControlModification.Add || modification == AccessControlModification.Set || modification == AccessControlModification.Reset) &&
                        (rule.ObjectFlags != ObjectAceFlags.None))
            {
                //
                // This will result in an object ace being added to the sacl, so the sacl revision must be AclRevisionDS
                //
                if (_securityDescriptor.SystemAcl.Revision < GenericAcl.AclRevisionDS)
                {
                    //
                    // we need to create a new sacl with the same aces as the existing one but the revision should be AclRevisionDS
                    //
                    byte[] binaryForm = new byte[_securityDescriptor.SystemAcl.BinaryLength];
                    _securityDescriptor.SystemAcl.GetBinaryForm(binaryForm, 0);
                    binaryForm[0] = GenericAcl.AclRevisionDS; // revision is the first byte of the binary form

                    _securityDescriptor.SystemAcl = new SystemAcl(IsContainer, IsDS, new RawAcl(binaryForm, 0));
                }
            }

            SecurityIdentifier sid = rule.IdentityReference.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier;

            switch (modification)
            {
                case AccessControlModification.Add:
                    //_securityDescriptor.SystemAcl.AddAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    _securityDescriptor.SystemAcl.AddAudit(sid, rule);
                    break;

                case AccessControlModification.Set:
                    //_securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    _securityDescriptor.SystemAcl.SetAudit(sid, rule);
                    break;

                case AccessControlModification.Reset:
                    _securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                    //_securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    _securityDescriptor.SystemAcl.SetAudit(sid, rule);
                    break;

                case AccessControlModification.Remove:
                    //result = _securityDescriptor.SystemAcl.RemoveAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    result = _securityDescriptor.SystemAcl.RemoveAudit(sid, rule);
                    break;

                case AccessControlModification.RemoveAll:
                    result = _securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                    if (result == false)
                    {
                        Debug.Assert(false, "Invalid operation");
                        throw new Exception();
                    }

                    break;

                case AccessControlModification.RemoveSpecific:
                    //_securityDescriptor.SystemAcl.RemoveAuditSpecific(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    _securityDescriptor.SystemAcl.RemoveAuditSpecific(sid, rule);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(
                        "modification",
                        SR.ArgumentOutOfRange_Enum);
            }

            modified = result;
            AuditRulesModified |= modified;
            return result;
        }
开发者ID:schaabs,项目名称:corefx,代码行数:88,代码来源:DirectoryObjectSecurity.cs


示例8: ModifyAccess

		protected override bool ModifyAccess (AccessControlModification modification, AccessRule rule, out bool modified)
		{
			foreach (AccessRule r in access_rules) {
				if (rule != r)
					continue;
				switch (modification) {
				case AccessControlModification.Add:
					AddAccessRule (rule);
					break;
				case AccessControlModification.Set:
					SetAccessRule (rule);
					break;
				case AccessControlModification.Reset:
					ResetAccessRule (rule);
					break;
				case AccessControlModification.Remove:
					RemoveAccessRule (rule);
					break;
				case AccessControlModification.RemoveAll:
					RemoveAccessRuleAll (rule);
					break;
				case AccessControlModification.RemoveSpecific:
					RemoveAccessRuleSpecific (rule);
					break;
				}
				modified = true;
				return true;
			}
			modified = false;
			return false;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:31,代码来源:CommonObjectSecurity.cs


示例9: ModifyAccess

        //
        // Modifies the DACL
        //
        private bool ModifyAccess(AccessControlModification modification, ObjectAccessRule rule, out bool modified)
        {
            bool result = true;

            if (_securityDescriptor.DiscretionaryAcl == null)
            {
                if (modification == AccessControlModification.Remove || modification == AccessControlModification.RemoveAll || modification == AccessControlModification.RemoveSpecific)
                {
                    modified = false;
                    return result;
                }

                _securityDescriptor.DiscretionaryAcl = new DiscretionaryAcl(IsContainer, IsDS, GenericAcl.AclRevisionDS, 1);
                _securityDescriptor.AddControlFlags(ControlFlags.DiscretionaryAclPresent);
            }
            else if ((modification == AccessControlModification.Add || modification == AccessControlModification.Set || modification == AccessControlModification.Reset ) && 
                        ( rule.ObjectFlags != ObjectAceFlags.None ))
            {
                //
                // This will result in an object ace being added to the dacl, so the dacl revision must be AclRevisionDS
                //
                if ( _securityDescriptor.DiscretionaryAcl.Revision < GenericAcl.AclRevisionDS )
                {
                    //
                    // we need to create a new dacl with the same aces as the existing one but the revision should be AclRevisionDS
                    //
                    byte[] binaryForm = new byte[_securityDescriptor.DiscretionaryAcl.BinaryLength];
                    _securityDescriptor.DiscretionaryAcl.GetBinaryForm(binaryForm, 0);
                    binaryForm[0] = GenericAcl.AclRevisionDS; // revision is the first byte of the binary form

                    _securityDescriptor.DiscretionaryAcl = new DiscretionaryAcl(IsContainer, IsDS, new RawAcl(binaryForm, 0));
                    
                }
            }

            SecurityIdentifier sid = rule.IdentityReference.Translate(typeof(SecurityIdentifier )) as SecurityIdentifier;

            if (rule.AccessControlType == AccessControlType.Allow)
            {
                switch (modification)
                {
                    case AccessControlModification.Add :
                        _securityDescriptor.DiscretionaryAcl.AddAccess(AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Set :
                        _securityDescriptor.DiscretionaryAcl.SetAccess(AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Reset :
                        _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Deny, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                        _securityDescriptor.DiscretionaryAcl.SetAccess(AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Remove :
                        result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.RemoveAll :
                        result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Allow, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                        if (result == false)
                        {
                            Contract.Assert(false, "Invalid operation");
                            throw new SystemException();
                        }

                        break;

                    case AccessControlModification.RemoveSpecific :
                        _securityDescriptor.DiscretionaryAcl.RemoveAccessSpecific(AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    default :
                        throw new ArgumentOutOfRangeException(
                            "modification",
                            Environment.GetResourceString( "ArgumentOutOfRange_Enum" ));
                }
            }
            else if (rule.AccessControlType == AccessControlType.Deny)
            {
                switch (modification)
                {
                    case AccessControlModification.Add :
                        _securityDescriptor.DiscretionaryAcl.AddAccess(AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Set :
                        _securityDescriptor.DiscretionaryAcl.SetAccess(AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Reset :
                        _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Allow, sid, -1, InheritanceFlags.ContainerInherit, 0, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                        _securityDescriptor.DiscretionaryAcl.SetAccess(AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                        break;

                    case AccessControlModification.Remove :
                        result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:DirectoryObjectSecurity.cs


示例10: ModifyAccess

        //
        // Modifies the DACL
        //
        protected override bool ModifyAccess(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            Contract.EndContractBlock();

            WriteLock();
            try
            {
                bool result = true;

                if ( _securityDescriptor.DiscretionaryAcl == null )
                {
                    if ( modification == AccessControlModification.Remove || 
                        modification == AccessControlModification.RemoveAll ||
                        modification == AccessControlModification.RemoveSpecific )
                    {
                        modified = false;
                        return result;
                    }

                    _securityDescriptor.DiscretionaryAcl = new DiscretionaryAcl( IsContainer, IsDS, GenericAcl.AclRevision, 1 );
                    _securityDescriptor.AddControlFlags(ControlFlags.DiscretionaryAclPresent);
                }

                SecurityIdentifier sid = rule.IdentityReference.Translate( typeof( SecurityIdentifier )) as SecurityIdentifier;

                if ( rule.AccessControlType == AccessControlType.Allow )
                {
                    switch ( modification )
                    {
                        case AccessControlModification.Add:
                            _securityDescriptor.DiscretionaryAcl.AddAccess( AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Set:
                            _securityDescriptor.DiscretionaryAcl.SetAccess( AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Reset:
                            _securityDescriptor.DiscretionaryAcl.RemoveAccess( AccessControlType.Deny, sid, -1, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, 0 );
                            _securityDescriptor.DiscretionaryAcl.SetAccess( AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Remove:
                            result = _securityDescriptor.DiscretionaryAcl.RemoveAccess( AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.RemoveAll:
                            result = _securityDescriptor.DiscretionaryAcl.RemoveAccess( AccessControlType.Allow, sid, -1, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, 0 );
                            if ( result == false )
                            {
                                Contract.Assert( false, "Invalid operation" );
                                throw new SystemException();
                            }

                            break;

                        case AccessControlModification.RemoveSpecific:
                            _securityDescriptor.DiscretionaryAcl.RemoveAccessSpecific( AccessControlType.Allow, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        default :
                            throw new ArgumentOutOfRangeException(
                                "modification",
                                Environment.GetResourceString( "ArgumentOutOfRange_Enum" ));
                    }
                }
                else if ( rule.AccessControlType == AccessControlType.Deny )
                {
                    switch ( modification )
                    {
                        case AccessControlModification.Add :
                            _securityDescriptor.DiscretionaryAcl.AddAccess( AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Set :
                            _securityDescriptor.DiscretionaryAcl.SetAccess( AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Reset :
                            _securityDescriptor.DiscretionaryAcl.RemoveAccess( AccessControlType.Allow, sid, -1, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, 0 );
                            _securityDescriptor.DiscretionaryAcl.SetAccess( AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.Remove :
                            result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Deny, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                            break;

                        case AccessControlModification.RemoveAll :
                            result = _securityDescriptor.DiscretionaryAcl.RemoveAccess(AccessControlType.Deny, sid, -1, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, 0 );
                            if ( result == false )
                            {
                                Contract.Assert( false, "Invalid operation" );
                                throw new SystemException();
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:CommonObjectSecurity.cs


示例11: ModifyAccess

		protected override bool ModifyAccess (AccessControlModification modification, AccessRule rule, out bool modified)
		{		
			if (null == rule)
				throw new ArgumentNullException ("rule");
				
			modified = true;
			
			WriteLock ();
			try {
				switch (modification) {
				case AccessControlModification.Add:
					descriptor.DiscretionaryAcl.AddAccess (rule.AccessControlType,
									       SidFromIR (rule.IdentityReference),
									       rule.AccessMask,
									       rule.InheritanceFlags,
									       rule.PropagationFlags);
					break;
				case AccessControlModification.Set:
					descriptor.DiscretionaryAcl.SetAccess (rule.AccessControlType,
									       SidFromIR (rule.IdentityReference),
									       rule.AccessMask,
									       rule.InheritanceFlags,
									       rule.PropagationFlags);
					break;
				case AccessControlModification.Reset:
					PurgeAccessRules (rule.IdentityReference);
					goto case AccessControlModification.Add;
				case AccessControlModification.Remove:
					modified = descriptor.DiscretionaryAcl.RemoveAccess (rule.AccessControlType,
											     SidFromIR (rule.IdentityReference),
											     rule.AccessMask,
											     rule.InheritanceFlags,
											     rule.PropagationFlags);
					break;
				case AccessControlModification.RemoveAll:
					PurgeAccessRules (rule.IdentityReference);
					break;
				case AccessControlModification.RemoveSpecific:
					descriptor.DiscretionaryAcl.RemoveAccessSpecific (rule.AccessControlType,
											  SidFromIR (rule.IdentityReference),
											  rule.AccessMask,
											  rule.InheritanceFlags,
											  rule.PropagationFlags);
					break;
				default:
					throw new ArgumentOutOfRangeException ("modification");
				}
				
				if (modified) AccessRulesModified = true;
			} finally {
				WriteUnlock ();
			}
			
			return modified;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:55,代码来源:CommonObjectSecurity.cs


示例12: ModifyAudit

		protected override bool ModifyAudit (AccessControlModification modification, AuditRule rule, out bool modified)
		{
			if (null == rule)
				throw new ArgumentNullException ("rule");

			modified = true;
			
			WriteLock ();
			try {
				switch (modification) {
				case AccessControlModification.Add:
					if (null == descriptor.SystemAcl)
						descriptor.SystemAcl = new SystemAcl (IsContainer, IsDS, 1);
					
					descriptor.SystemAcl.AddAudit (rule.AuditFlags,
								       SidFromIR (rule.IdentityReference),
								       rule.AccessMask,
								       rule.InheritanceFlags,
								       rule.PropagationFlags);
					break;
				case AccessControlModification.Set:
					if (null == descriptor.SystemAcl)
						descriptor.SystemAcl = new SystemAcl (IsContainer, IsDS, 1);

					descriptor.SystemAcl.SetAudit (rule.AuditFlags,
								       SidFromIR (rule.IdentityReference),
								       rule.AccessMask,
								       rule.InheritanceFlags,
								       rule.PropagationFlags);
					break;
				case AccessControlModification.Reset:
					break;
				case AccessControlModification.Remove:
					if (null == descriptor.SystemAcl)
						modified = false;
					else
						modified = descriptor.SystemAcl.RemoveAudit (rule.AuditFlags,
											     SidFromIR (rule.IdentityReference),
											     rule.AccessMask,
											     rule.InheritanceFlags,
											     rule.PropagationFlags);
					break;
				case AccessControlModification.RemoveAll:
					PurgeAuditRules (rule.IdentityReference);
					break;
				case AccessControlModification.RemoveSpecific:
					if (null != descriptor.SystemAcl)
						descriptor.SystemAcl.RemoveAuditSpecific (rule.AuditFlags,
											  SidFromIR (rule.IdentityReference),
											  rule.AccessMask,
											  rule.InheritanceFlags,
											  rule.PropagationFlags);
					break;
				default:
					throw new ArgumentOutOfRangeException ("modification");
				}
				
				if (modified) AuditRulesModified = true;
			} finally {
				WriteUnlock ();
			}
			
			return modified;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:64,代码来源:CommonObjectSecurity.cs


示例13: ModifyAudit

    protected override bool ModifyAudit(AccessControlModification modification, AuditRule rule, out bool modified)
    {
      modified = default(bool);

      return default(bool);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:6,代码来源:System.Security.AccessControl.DirectoryObjectSecurity.cs


示例14: ModifyAccessRule

		public override bool ModifyAccessRule (AccessControlModification modification, AccessRule rule, out bool modified)
		{
			throw new NotImplementedException ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:4,代码来源:ActiveDirectorySecurity.cs


示例15: ModifyAccessRule

 public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
 {
     bool flag;
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (!this.AccessRuleType.IsAssignableFrom(rule.GetType()))
     {
         throw new ArgumentException(Environment.GetResourceString("AccessControl_InvalidAccessRuleType"), "rule");
     }
     this.WriteLock();
     try
     {
         flag = this.ModifyAccess(modification, rule, out modified);
     }
     finally
     {
         this.WriteUnlock();
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:ObjectSecurity.cs


示例16: ModifyAuditRule

		public virtual bool ModifyAuditRule (AccessControlModification modification, AuditRule rule, out bool modified)
		{
			if (rule == null)
				throw new ArgumentNullException ("rule");

			if (!AuditRuleType.IsAssignableFrom (rule.GetType()))
				throw new ArgumentException ("rule");
				
			return ModifyAudit (modification, rule, out modified);
		}
开发者ID:nicolas-raoul,项目名称:mono,代码行数:10,代码来源:ObjectSecurity.cs


示例17: ModifyAuditRule

	public virtual bool ModifyAuditRule(AccessControlModification modification, AuditRule ruleout , System.Boolean& modified) {}
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:1,代码来源:EventWaitHandleSecurity.cs


示例18: ModifyAccess

 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);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DirectoryObjectSecurity.cs


示例19: ModifyAudit

        //
        // Modifies the SACL
        //

        protected override bool ModifyAudit( AccessControlModification modification, AuditRule rule, out bool modified )
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            Contract.EndContractBlock();

            WriteLock();
            try
            {
                bool result = true;

                if ( _securityDescriptor.SystemAcl == null )
                {
                    if ( modification == AccessControlModification.Remove || 
                        modification == AccessControlModification.RemoveAll ||
                        modification == AccessControlModification.RemoveSpecific )
                    {
                        modified = false;
                        return result;
                    }

                    _securityDescriptor.SystemAcl = new SystemAcl( IsContainer, IsDS, GenericAcl.AclRevision, 1 );
                    _securityDescriptor.AddControlFlags(ControlFlags.SystemAclPresent);
                }

                SecurityIdentifier sid = rule.IdentityReference.Translate( typeof( SecurityIdentifier )) as SecurityIdentifier;

                switch ( modification )
                {
                    case AccessControlModification.Add :
                        _securityDescriptor.SystemAcl.AddAudit( rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                        break;

                    case AccessControlModification.Set :
                        _securityDescriptor.SystemAcl.SetAudit( rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                        break;

                    case AccessControlModification.Reset :
                        _securityDescriptor.SystemAcl.SetAudit( rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                        break;

                    case AccessControlModification.Remove :
                        result = _securityDescriptor.SystemAcl.RemoveAudit( rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                        break;

                    case AccessControlModification.RemoveAll :
                        result = _securityDescriptor.SystemAcl.RemoveAudit( AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, 0 );
                        if ( result == false )
                        {
                            throw new InvalidProgramException();
                        }

                        break;

                    case AccessControlModification.RemoveSpecific :
                        _securityDescriptor.SystemAcl.RemoveAuditSpecific(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags );
                        break;

                    default :
                        throw new ArgumentOutOfRangeException(
                            "modification",
                            Environment.GetResourceString( "ArgumentOutOfRange_Enum" ));
                }

                modified = result;
                AuditRulesModified |= modified;
                return result;
            }
            finally
            {
                WriteUnlock();
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:79,代码来源:CommonObjectSecurity.cs


示例20: ModifyAudit

        private bool ModifyAudit(AccessControlModification modification, ObjectAuditRule rule, out bool modified)
        {
            bool flag = true;
            if (base._securityDescriptor.SystemAcl == null)
            {
                if (((modification == AccessControlModification.Remove) || (modification == AccessControlModification.RemoveAll)) || (modification == AccessControlModification.RemoveSpecific))
                {
                    modified = false;
                    return flag;
                }
                base._securityDescriptor.SystemAcl = new SystemAcl(base.IsContainer, base.IsDS, GenericAcl.AclRevisionDS, 1);
                base._securityDescriptor.AddControlFlags(ControlFlags.SystemAclPresent);
            }
            else if ((((modification == AccessControlModification.Add) || (modification == AccessControlModification.Set)) || (modification == AccessControlModification.Reset)) && ((rule.ObjectFlags != ObjectAceFlags.None) && (base._securityDescriptor.SystemAcl.Revision < GenericAcl.AclRevisionDS)))
            {
                byte[] binaryForm = new byte[base._securityDescriptor.SystemAcl.BinaryLength];
                base._securityDescriptor.SystemAcl.GetBinaryForm(binaryForm, 0);
                binaryForm[0] = GenericAcl.AclRevisionDS;
                base._securityDescriptor.SystemAcl = new SystemAcl(base.IsContainer, base.IsDS, new RawAcl(binaryForm, 0));
            }
            SecurityIdentifier sid = rule.IdentityReference.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier;
            switch (modification)
            {
                case AccessControlModification.Add:
                    base._securityDescriptor.SystemAcl.AddAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    break;

                case AccessControlModification.Set:
                    base._securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    break;

                case AccessControlModification.Reset:
                    base._securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit, PropagationFlags.None, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                    base._securityDescriptor.SystemAcl.SetAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    break;

                case AccessControlModification.Remove:
                    flag = base._securityDescriptor.SystemAcl.RemoveAudit(rule.AuditFlags, sid, rule.AccessMask, rule.InheritanceFlags, rule.PropagationFlags, rule.ObjectFlags, rule.ObjectType, rule.InheritedObjectType);
                    break;

                case AccessControlModification.RemoveAll:
                    flag = base._securityDescriptor.SystemAcl.RemoveAudit(AuditFlags.Failure | AuditFlags.Success, sid, -1, InheritanceFlags.ContainerInherit, PropagationFlags.None, ObjectAceFlags.None, Guid.Empty, Guid.Empty);
                    if (!flag)
                    {
                    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AccessControlSections类代码示例发布时间:2022-05-24
下一篇:
C# AccessCondition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap