Example #1
0
        /// <summary>
        /// Call handlers and check if sending a message to the clients connected to the SO is allowed.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="arguments"></param>
        /// <returns></returns>
        protected bool IsSendAllowed(string message, IList arguments)
        {
            // Check internal handlers first
            foreach (ISharedObjectSecurity handler in _securityHandlers)
            {
                if (!handler.IsSendAllowed(this, message, arguments))
                {
                    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.IsSendAllowed(this, message, arguments))
                {
                    return(false);
                }
            }
            return(true);
        }