Example #1
0
        /// <summary>
        /// Call handlers and check if writing to the SO is allowed.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        protected bool IsWriteAllowed(string key, object value)
        {
            // Check internal handlers first
            foreach (ISharedObjectSecurity handler in _securityHandlers)
            {
                if (!handler.IsWriteAllowed(this, key, value))
                {
                    return(false);
                }
            }
            // Check global SO handlers next
            IEnumerator handlers = GetSecurityHandlers();

            if (handlers == null)
            {
                return(true);
            }
            while (handlers.MoveNext())
            {
                ISharedObjectSecurity handler = handlers.Current as ISharedObjectSecurity;
                if (!handler.IsWriteAllowed(this, key, value))
                {
                    return(false);
                }
            }
            return(true);
        }