public AuthorizeAttribute(double minAppVersion, bool allowAnonymous = false, OsNames os = OsNames.Everything, params string[] allowedOsVersions) { AllowAnonymous = allowAnonymous; MinimumAppVersion = minAppVersion; AllowedOs = os.ToString(); AllowedOsVersions = allowedOsVersions.Where(x => !string.IsNullOrEmpty(x)).ToArray(); Status = new AuthorizeStatus { Message = StatusEnum.Forbidden.GetDisplayName(), Success = false }; }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (SmsCache.UserContext == null || SmsCache.UserContext.UserID == 0 || SmsCache.UserContext.CurrentBranchId == 0) { Status = AuthorizeStatus.NotLogin; return(false); } if (!SmsCache.UserAccesses.AuthorizeSession()) { HttpContext.Current.Session.Abandon(); Status = AuthorizeStatus.NotLogin; return(false); } var authorized = SmsCache.UserContext.IsSystemAdmin || SmsCache.UserContext.AllowPageIDs.Contains(pageID); Status = !authorized ? AuthorizeStatus.DontHaveAccessRight : AuthorizeStatus.HasAccessRight; return(authorized); }
private AuthorizeResult(T?val, AuthorizeStatus status) { Status = status; Value = val; }
private AuthorizeResult(AuthorizeStatus status) { Status = status; }