コード例 #1
0
ファイル: CatsAuthorize.cs プロジェクト: reerp/REERPE
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }

            if (!httpContext.User.Identity.IsAuthenticated)
            {
                return(false);
            }
            return(ewCache.CheckAccess(constants.ItemName(operation), DateTime.Now) == AuthorizationType.Allow ? true : false);
        }
コード例 #2
0
        public static MvcHtmlString PSNPOperationMenuItem(this HtmlHelper helper, string text, string url, PsnpConstants.Operation operation, string ccsClass = "", string dataButtontype = "")
        {
            var constants = new PsnpConstants();
            var ewCache   = UserAccountHelper.GetUserPermissionCache(CatsGlobals.Applications.PSNP);

            // If cache is null then force the user to sign-in again
            if (null == ewCache)
            {
                Signout();
                return(MvcHtmlString.Create(string.Empty));
            }

            var html = string.Empty;

            if (ewCache.CheckAccess(constants.ItemName(operation), DateTime.Now) == AuthorizationType.Allow)
            {
                html = @"<a data-buttontype=" + dataButtontype + "  class=" + ccsClass + " href=" + url + ">" + text + "</a>";
            }
            return(MvcHtmlString.Create(html));
        }