override public IPermission Union(IPermission target) { if (null == target) { return(this.Copy()); } if (target.GetType() != this.GetType()) { throw ADP.PermissionTypeMismatch(); } if (IsUnrestricted()) // MDAC 84803 { return(this.Copy()); } DBDataPermission newPermission = (DBDataPermission)target.Copy(); if (!newPermission.IsUnrestricted()) { newPermission._allowBlankPassword |= AllowBlankPassword; if (null != _keyvalues) { foreach (DBConnectionString entry in _keyvalues) { newPermission.AddPermissionEntry(entry); } } } return(newPermission.IsEmpty() ? null : newPermission); }
public override IPermission Union(IPermission target) { if (target == null) { return(this.Copy()); } if (target.GetType() != base.GetType()) { throw ADP.PermissionTypeMismatch(); } if (this.IsUnrestricted()) { return(this.Copy()); } DBDataPermission permission = (DBDataPermission)target.Copy(); if (!permission.IsUnrestricted()) { permission._allowBlankPassword |= this.AllowBlankPassword; if (this._keyvalues != null) { foreach (DBConnectionString str in this._keyvalues) { permission.AddPermissionEntry(str); } } } if (!permission.IsEmpty()) { return(permission); } return(null); }
override public IPermission Intersect(IPermission target) // used during Deny actions { if (null == target) { return(null); } if (target.GetType() != this.GetType()) { throw ADP.PermissionTypeMismatch(); } if (this.IsUnrestricted()) // MDAC 84803, NDPWhidbey 29121 { return(target.Copy()); } DBDataPermission operand = (DBDataPermission)target; if (operand.IsUnrestricted()) // NDPWhidbey 29121 { return(this.Copy()); } DBDataPermission newPermission = (DBDataPermission)operand.Copy(); newPermission._allowBlankPassword &= AllowBlankPassword; if ((null != _keyvalues) && (null != newPermission._keyvalues)) { newPermission._keyvalues.Clear(); newPermission._keyvaluetree.Intersect(newPermission._keyvalues, _keyvaluetree); } else { // either target.Add or this.Add have not been called // return a non-null object so IsSubset calls will fail newPermission._keyvalues = null; newPermission._keyvaluetree = null; } if (newPermission.IsEmpty()) // no intersection, MDAC 86773 { newPermission = null; } return(newPermission); }
public override IPermission Intersect(IPermission target) { // FIXME: restrictions not completely implemented - nor documented DBDataPermission dbdp = Cast(target); if (dbdp == null) { return(null); } if (IsUnrestricted()) { if (dbdp.IsUnrestricted()) { DBDataPermission u = CreateInstance(); u.state = PermissionState.Unrestricted; return(u); } return(dbdp.Copy()); } if (dbdp.IsUnrestricted()) { return(Copy()); } if (IsEmpty() || dbdp.IsEmpty()) { return(null); } DBDataPermission p = CreateInstance(); p.allowBlankPassword = (allowBlankPassword && dbdp.allowBlankPassword); foreach (DictionaryEntry de in _connections) { object o = dbdp._connections [de.Key]; if (o != null) { p._connections.Add(de.Key, de.Value); } } return((p._connections.Count > 0) ? p : null); }
/// <include file='doc\DBDataPermission.uex' path='docs/doc[@for="DBDataPermission.Intersect"]/*' /> override public IPermission Intersect(IPermission target) // used during Deny actions { if (null == target) { return(null); } if (target.GetType() != this.GetType()) { throw ADP.Argument("target"); } if (IsUnrestricted()) // MDAC 84803 { return(Copy()); } DBDataPermission newPermission = (DBDataPermission)target.Copy(); if (!newPermission.IsUnrestricted()) { newPermission._allowBlankPassword &= AllowBlankPassword; if ((null != _keyvalues) && (null != newPermission._keyvalues)) { newPermission._keyvalues.Clear(); newPermission._keyvaluetree.Intersect(newPermission._keyvalues, _keyvaluetree); } else { // either target.Add or this.Add have not been called // return a non-null object so IsSubset calls will fail newPermission._keyvalues = null; newPermission._keyvaluetree = null; } if (newPermission.IsEmpty()) // MDAC 86773 { newPermission = null; } } return(newPermission); }
public override IPermission Intersect(IPermission target) { if (target == null) { return(null); } if (target.GetType() != base.GetType()) { throw ADP.PermissionTypeMismatch(); } if (this.IsUnrestricted()) { return(target.Copy()); } DBDataPermission permission2 = (DBDataPermission)target; if (permission2.IsUnrestricted()) { return(this.Copy()); } DBDataPermission permission = (DBDataPermission)permission2.Copy(); permission._allowBlankPassword &= this.AllowBlankPassword; if ((this._keyvalues != null) && (permission._keyvalues != null)) { permission._keyvalues.Clear(); permission._keyvaluetree.Intersect(permission._keyvalues, this._keyvaluetree); } else { permission._keyvalues = null; permission._keyvaluetree = null; } if (permission.IsEmpty()) { permission = null; } return(permission); }
public override IPermission Union(IPermission target) { // FIXME: restrictions not completely implemented - nor documented DBDataPermission dbdp = Cast(target); if (dbdp == null) { return(Copy()); } if (IsEmpty() && dbdp.IsEmpty()) { return(Copy()); } DBDataPermission p = CreateInstance(); if (IsUnrestricted() || dbdp.IsUnrestricted()) { p.state = PermissionState.Unrestricted; } else { p.allowBlankPassword = (allowBlankPassword || dbdp.allowBlankPassword); p._connections = new Hashtable(_connections.Count + dbdp._connections.Count); foreach (DictionaryEntry de in _connections) { p._connections.Add(de.Key, de.Value); } // don't duplicate foreach (DictionaryEntry de in dbdp._connections) { p._connections [de.Key] = de.Value; } } return(p); }