예제 #1
0
        /// <summary>
        /// Returns whether or not the given user has
        /// access to the given application element.
        /// </summary>
        /// <param name="userName">
        /// User name for which to check access rights.
        /// </param>
        /// <param name="itemName">
        /// Application element identifier.
        /// </param>
        public virtual bool IsActionAllowed(string userName, string itemName)
        {
            if (userName == AdminUserName)
            {
                return(true);
            }

            if (!Users.ContainsKey(userName))
            {
                return(false);
            }

            foreach (AccessType accessType in ItemAccess.GetAccessTypes(itemName))
            {
                if (UserTypes.HasAccessRight(Users[userName].UserType, itemName, accessType))
                {
                    return(true);
                }
            }

            return(false);
        }