/// <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); }
/// <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); }
/// <summary> /// Override GetHashCode for object /// </summary> /// <returns></returns> public override int GetHashCode() { unchecked { int hashCode = 1; hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ParentController != null ? ParentController.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ParentAction != null ? ParentAction.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ParentArea != null ? ParentArea.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Area != null ? Area.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Controller != null ? Controller.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Action != null ? Action.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ControllerSecurity != null ? ControllerSecurity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ActionSecurity != null ? ActionSecurity.GetHashCode() : 0); return(hashCode); } }