Example #1
0
        /// <summary>
        /// Whether the user is authorized to see the menu item.
        /// </summary>
        internal bool IsAuthorized(ClaimSubset identity, bool isPreprodOrProd)
        {
            bool controllerAuthorized = ControllerSecurity != null && ControllerSecurity.IsAuthorized(identity, isPreprodOrProd);
            bool actionAuthorized     = ActionSecurity != null && ActionSecurity.IsAuthorized(identity, isPreprodOrProd);

            // Authorized if:
            // - controller authorized and:
            //      - action authorized or no action security specified (use controller security)
            // - or action authorized.
            return((controllerAuthorized && (actionAuthorized || ActionSecurity == null)) || actionAuthorized);
        }
Example #2
0
        /// <summary>
        /// Whether the user is authorized to see the menu item.
        /// </summary>
        public bool IsAuthorized(ClaimsIdentity identity)
        {
            bool controllerAuthorized = ControllerSecurity != null && ControllerSecurity.IsAuthorized(identity);
            bool actionAuthorized     = ActionSecurity != null && ActionSecurity.IsAuthorized(identity);

            // Authorized if:
            // - controller authorized and:
            //      - action authorized or no action security specified (use controller security)
            // - or action authorized.
            return((controllerAuthorized && (actionAuthorized || ActionSecurity == null)) || actionAuthorized);
        }