Esempio n. 1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext == null)
            {
                throw new ArgumentNullException("filterContext");
            }

            if (SharePointLicenseProvider.Current == null)
            {
                SharePointLicenseProvider.NewProvider(filterContext.HttpContext);
            }
        }
Esempio n. 2
0
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (_refreshCache || SharePointLicenseProvider.Current == null)
            {
                SharePointLicenseProvider.NewProvider(filterContext.HttpContext);
            }

            if (_licenseTypes.Length == 0 ||
                SharePointLicenses.Current.licenseType == LicenseType.None ||
                !_licenseTypes.Contains(SharePointLicenses.Current.licenseType) ||
                (SharePointLicenses.Current.licenseType == LicenseType.Trial && !SharePointLicenses.Current.allowTestMode))
            {
                filterContext.Result = new ViewResult {
                    ViewName = "NoLicense",
                    ViewData = new ViewDataDictionary(new TestLicenseData())
                };
            }
        }
 public static SharePointLicenseProvider NewProvider(HttpContextBase httpContext)
 {
     SharePointLicenseProvider.current = new SharePointLicenses(httpContext);
     return SharePointLicenseProvider.current;
 }
Esempio n. 4
0
 public static SharePointLicenseProvider NewProvider(HttpContextBase httpContext)
 {
     SharePointLicenseProvider.current = new SharePointLicenses(httpContext);
     return(SharePointLicenseProvider.current);
 }