public BaseApiController(IWebApiContentService mainService) : base() { this.mainService = mainService; this.htmlToViewHelper = mainService.HtmlToViewHelper; this.utilService = mainService.UtilService; this.logService = mainService.LogService; this.accountService = mainService.AccountService; }
public ExcelController(IWebApiContentService mainService, IMiscService miscService, IProjectService projectService) : base(mainService) { //this.LogType = "Test"; //this.LogTypeResponse = "TestResponse"; this.miscService = miscService; this.projectService = projectService; }
public ProjectController(IWebApiContentService mainService, IProjectService projectService, ICustomerService customerService, IMiscService miscService) : base(mainService) { this.projectService = projectService; this.customerService = customerService; this.RaiseErrorMessageEvent += this.GetErrorMessageEvent; this.miscService = miscService; }
public FileController(IWebApiContentService mainService, ICustomerFileService customerFileService) : base(mainService) { this.customerFileService = customerFileService; }
//private string LogType; //private string LogTypeResponse; public AlfredController(IWebApiContentService mainService) : base(mainService) { }
public AccountController(IWebApiContentService webApiContentService) : base(webApiContentService) { }
//private string LogType; //private string LogTypeResponse; public TestController(IWebApiContentService mainService) : base(mainService) { //this.LogType = "Test"; //this.LogTypeResponse = "TestResponse"; }
public PanelsController(IWebApiContentService mainService, IPanelService panelService) : base(mainService) { this.panelService = panelService; }
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { //context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); var unityContainer = UnityConfig.GetConfiguredContainer(); IAccountService accountService = unityContainer.Resolve <IAccountService>(); UserLoginResultServiceModel loginResult = await accountService.Login(context.UserName, context.Password, false); if (loginResult == null) { context.SetError("invalid_grant", ErrorResources.UserOrEmailNorValid); return; } else { if (loginResult.Succeeded) { string rolesFlag = accountService.GetRolesKeyFlagsForUser(loginResult.LoggedUser.Id); ClaimsIdentity identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim("sub", context.UserName)); identity.AddClaim(new Claim("role", rolesFlag)); AuthenticationProperties props; AuthenticationTicket authTicket; long recentProjectId = 0; if (rolesFlag.ToUpper() != "C") { IWebApiContentService mainService = unityContainer.Resolve <IWebApiContentService>(); var rmRecentProject = mainService.GetMostRecentProjectId(); if (rmRecentProject.Success) { recentProjectId = rmRecentProject.Value; } } var name = string.Format("{0} {1}", loginResult.LoggedUser.Name, loginResult.LoggedUser.Surname); if (string.IsNullOrWhiteSpace(name)) { name = loginResult.LoggedUser.UserName; } props = new AuthenticationProperties( new Dictionary <string, string> { { "roleFlag", rolesFlag }, { "name", name }, { "rpId", recentProjectId.ToString() } } ); authTicket = new AuthenticationTicket(identity, props); context.Validated(authTicket); } else { context.SetError("invalid_grant", loginResult.FailMessage); return; } } }
public UploadController(IWebApiContentService mainService, IFileService fileService) : base(mainService) { this.fileService = fileService; }