Example #1
0
        /// <summary>
        /// Call handlers and check if connection to the existing SO is allowed.
        /// </summary>
        /// <returns></returns>
        protected bool IsConnectionAllowed()
        {
            // Check internal handlers first
            foreach (ISharedObjectSecurity handler in _securityHandlers)
            {
                if (!handler.IsConnectionAllowed(this))
                {
                    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.IsConnectionAllowed(this))
                {
                    return(false);
                }
            }
            return(true);
        }