protected override void OnStart(string[] args) { try { _reg.Run(); #region backgroundWorkerSignalR var backgroundWorkerSignalR = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; backgroundWorkerSignalR.DoWork += (sender, eventArgs) => { var url = ConfigurationManager.AppSettings["SignalRUrl"]; WebApp.Start(url); }; if (!backgroundWorkerSignalR.IsBusy) { // Start the asynchronous operation. backgroundWorkerSignalR.RunWorkerAsync(); } #endregion _diagnosticService.Info("Service start"); } catch (Exception ex) { _diagnosticService.Error(ex); } }
protected override bool AuthorizeCore(HttpContextBase httpContext) { var user = httpContext.User as IQuickspatchPrincipal; if (user == null) { return(false); } _diagnosticService = DependencyResolver.Current.GetService <IDiagnosticService>(); _diagnosticService.Info("Begin AuthorizeCore"); if (DocumentTypeKey == DocumentTypeKey.None) { return(true); } //return true; var objectAuthorization = DependencyResolver.Current.GetService <IOperationAuthorization>(); List <UserRoleFunction> userRoleFunctions; var exception = new UnAuthorizedAccessException("UnAuthorizedAccessText") { QuickspatchUserName = user.User != null ? user.User.UserName : null }; //Check this franchisee can use some module from license key if (ConstantValue.DeploymentMode == DeploymentMode.Franchisee) { if (!string.IsNullOrEmpty(user.User.UserRole.AppRoleName) && user.User.UserRole.AppRoleName.Equals("GlobalAdmin", StringComparison.InvariantCultureIgnoreCase)) { return(true); } if (MenuExtractData.Instance.ModuleForFranchisee != null && MenuExtractData.Instance.ModuleForFranchisee.ListModuleDocumentTypeOperations.Count > 0) { // Check this document type key have permision in this module for franchisee var hasPermissionForModule = MenuExtractData.Instance.ModuleForFranchisee.ListModuleDocumentTypeOperations.Any( o => o.DocumentTypeId == (int)DocumentTypeKey && o.OperationId == (int)OperationAction); if (!hasPermissionForModule) { throw exception; } } } var permission = objectAuthorization.VerifyAccess(DocumentTypeKey, OperationAction, out userRoleFunctions); httpContext.Items["UserRoleFunctions"] = userRoleFunctions; if (!permission) { throw exception; } //_diagnosticService.Info("AuthorizeCore Completed."); return(true); }