NetSqlAzMan Check Access Helper Class for NetSqlAzMan 'PSNP' Application
Inheritance: IPSNPCheckAccess
Exemplo n.º 1
0
        public static MvcHtmlString PSNPOperationMenuItem(this HtmlHelper helper, string text, string url, PSNPCheckAccess.Operation operation, string ccsClass="", string dataButtontype="")
        {
            var user = (UserIdentity)HttpContext.Current.User.Identity;
            var checkAccessHelper = DependencyResolver.Current.GetService<IPSNPCheckAccess>();
            var dbUser = checkAccessHelper.Storage.GetDBUser(user.Profile.UserName).CustomSid;

            var html = string.Empty;

            if (checkAccessHelper.CheckAccess(operation, dbUser))
            {
                html = @"<a data-buttontype=" + dataButtontype + "  class=" + ccsClass + " href=" + url + ">" + text + "</a>";
            }
            return MvcHtmlString.Create(html);
        }
Exemplo n.º 2
0
        public static MvcHtmlString PSNPOperationButton(this HtmlHelper helper, string url, PSNPCheckAccess.Operation operation, string text = "", string ccsClass = "", string dataButtontype = "", string id = "")
        {
            var user = (UserIdentity)HttpContext.Current.User.Identity;
            var checkAccessHelper = DependencyResolver.Current.GetService<IPSNPCheckAccess>();
            var dbUser = checkAccessHelper.Storage.GetDBUser(user.Profile.UserName).CustomSid;

            var html = string.Empty;

            if (checkAccessHelper.CheckAccess(operation, dbUser))
            {
                html = "<a href=" + url;
                if (ccsClass != "")
                {
                    html += " class=" + ccsClass;
                }
                if (id != "")
                {
                    html += " id=" + id;
                }
                if (dataButtontype != "")
                {
                    html += " data-buttontype=" + dataButtontype;
                }
                if (text != "")
                {
                    html += " >" + text + "</a>";
                }
                else
                {
                    html += " ></a>";
                }
            }
            return MvcHtmlString.Create(html);
        }