Ejemplo n.º 1
0
        private void CopyFrom(OraclePermission permission)
        {
            _isUnrestricted = permission.IsUnrestricted();
            if (!_isUnrestricted)
            {
                _allowBlankPassword = permission.AllowBlankPassword;

                try {
                    lock (permission) { // single writer, multiple reader
                        if (null != permission._keyvalues)
                        {
                            _keyvalues = (ArrayList)permission._keyvalues.Clone();

                            if (null != permission._keyvaluetree)
                            {
                                _keyvaluetree = permission._keyvaluetree.Copy();
                            }
                        }
                    }
                }
                catch { // MDAC 80973
                    throw;
                }
            }
        }
Ejemplo n.º 2
0
        /// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.Union"]/*' />
        override public IPermission Union(IPermission target)
        {
            if (null == target)
            {
                return(this.Copy());
            }
            if (target.GetType() != this.GetType())
            {
                throw ADP.Argument("target");
            }
            if (IsUnrestricted())   // MDAC 84803
            {
                return(this.Copy());
            }
            OraclePermission newPermission = (OraclePermission)target.Copy();

            if (!newPermission.IsUnrestricted())
            {
                newPermission._allowBlankPassword |= AllowBlankPassword;

                if (null != _keyvalues)
                {
                    foreach (DBConnectionString entry in _keyvalues)
                    {
                        newPermission.AddEntry(entry);
                    }
                }
            }
            return(newPermission);
        }
        public override IPermission Union(IPermission target)
        {
            if (target == null)
            {
                return(this.Copy());
            }
            if (target.GetType() != base.GetType())
            {
                throw System.Data.Common.ADP.PermissionTypeMismatch();
            }
            if (this.IsUnrestricted())
            {
                return(this.Copy());
            }
            OraclePermission permission = (OraclePermission)target.Copy();

            if (!permission.IsUnrestricted())
            {
                permission._allowBlankPassword |= this.AllowBlankPassword;
                if (this._keyvalues != null)
                {
                    foreach (System.Data.OracleClient.DBConnectionString str in this._keyvalues)
                    {
                        permission.AddPermissionEntry(str);
                    }
                }
            }
            if (!permission.IsEmpty())
            {
                return(permission);
            }
            return(null);
        }
        public override bool IsSubsetOf(IPermission target)
        {
            if (target == null)
            {
                return(this.IsEmpty());
            }
            if (target.GetType() != base.GetType())
            {
                throw System.Data.Common.ADP.PermissionTypeMismatch();
            }
            OraclePermission permission = target as OraclePermission;
            bool             flag       = permission.IsUnrestricted();

            if ((!flag && !this.IsUnrestricted()) && (!this.AllowBlankPassword || permission.AllowBlankPassword))
            {
                if ((this._keyvalues != null) && (permission._keyvaluetree == null))
                {
                    return(flag);
                }
                flag = true;
                if (this._keyvalues == null)
                {
                    return(flag);
                }
                foreach (System.Data.OracleClient.DBConnectionString str in this._keyvalues)
                {
                    if (!permission._keyvaluetree.CheckValueForKeyPermit(str))
                    {
                        return(false);
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 5
0
        /// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.IsSubsetOf"]/*' />
        override public bool IsSubsetOf(IPermission target)
        {
            if (null == target)
            {
                return(IsEmpty());
            }
            if (target.GetType() != this.GetType())
            {
                throw ADP.WrongType(this.GetType());
            }
            OraclePermission superset = (target as OraclePermission);

#if DATAPERMIT
            if (null != superset._keyvalues)
            {
                Debug.WriteLine("+ " + (superset._keyvalues[0] as DBConnectionString).ConnectionString);
            }
            else
            {
                Debug.WriteLine("+ <>");
            }
            if (null != _keyvalues)
            {
                Debug.WriteLine("- " + (_keyvalues[0] as DBConnectionString).ConnectionString);
            }
            else
            {
                Debug.WriteLine("- <>");
            }
#endif
            bool subset = superset.IsUnrestricted();
            if (!subset)
            {
                subset = (!IsUnrestricted() &&
                          (!AllowBlankPassword || superset.AllowBlankPassword) &&
                          ((null == _keyvalues) || (null != superset._keyvaluetree)));

                if (subset && (null != _keyvalues))
                {
                    foreach (DBConnectionString kventry in _keyvalues)
                    {
                        if (!superset._keyvaluetree.CheckValueForKeyPermit(kventry))
                        {
                            subset = false;
                            break;
                        }
                    }
                }
            }
            return(subset);
        }
 private void CopyFrom(OraclePermission permission)
 {
     this._isUnrestricted = permission.IsUnrestricted();
     if (!this._isUnrestricted)
     {
         this._allowBlankPassword = permission.AllowBlankPassword;
         if (permission._keyvalues != null)
         {
             this._keyvalues = (ArrayList)permission._keyvalues.Clone();
             if (permission._keyvaluetree != null)
             {
                 this._keyvaluetree = permission._keyvaluetree.CopyNameValue();
             }
         }
     }
 }
Ejemplo n.º 7
0
        /// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.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());
            }
            OraclePermission newPermission = (OraclePermission)target.Copy();

            if (!newPermission.IsUnrestricted())
            {
                newPermission._allowBlankPassword &= AllowBlankPassword;

                if ((null != _keyvalues) && (null != newPermission._keyvalues))
                {
                    newPermission._keyvalues.Clear();

                    newPermission._keyvaluetree.Intersect(newPermission._keyvalues, _keyvaluetree);
                    if (0 == newPermission._keyvalues.Count)   // no intersection
                    {
                        newPermission = null;
                    }
                }
                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;
                }
            }
            return(newPermission);
        }
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }
            if (target.GetType() != base.GetType())
            {
                throw System.Data.Common.ADP.PermissionTypeMismatch();
            }
            if (this.IsUnrestricted())
            {
                return(target.Copy());
            }
            OraclePermission permission2 = (OraclePermission)target;

            if (permission2.IsUnrestricted())
            {
                return(this.Copy());
            }
            OraclePermission permission = (OraclePermission)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);
        }
 private void CopyFrom(OraclePermission permission)
 {
     this._isUnrestricted = permission.IsUnrestricted();
     if (!this._isUnrestricted)
     {
         this._allowBlankPassword = permission.AllowBlankPassword;
         if (permission._keyvalues != null)
         {
             this._keyvalues = (ArrayList) permission._keyvalues.Clone();
             if (permission._keyvaluetree != null)
             {
                 this._keyvaluetree = permission._keyvaluetree.CopyNameValue();
             }
         }
     }
 }