コード例 #1
0
ファイル: MenuModel.cs プロジェクト: Quarterback16/Tycoon.API
        /// <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);
        }
コード例 #2
0
ファイル: MenuModel.cs プロジェクト: Quarterback16/Tycoon.API
        /// <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);
        }