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()); } SqlClientPermission newPermission = (SqlClientPermission)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); }
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); }