protected override async Task OnInitializedAsync() { RosterTBC = await APIAccessService.GetRosterTBCAsync(); dataIsLoaded = true; await base.OnInitializedAsync(); }
protected override async Task OnInitializedAsync() { RaidTBC = await APIAccessService.GetRaidTbcLootAsync(RaidName); dataIsLoaded = true; await base.OnInitializedAsync(); }
protected override async Task OnInitializedAsync() { BiS = await APIAccessService.GetBiSLists(); dataIsLoaded = true; await base.OnInitializedAsync(); }
public object PostAddEdit(APIAccessDTO APIAccessDTO) { using (APIAccessService apiAccessService = new APIAccessService()) { ResultOperation resultOperation = null; sysBpmsAPIAccess apiAccess = new sysBpmsAPIAccess().Update(APIAccessDTO.Name, APIAccessDTO.IPAddress, APIAccessDTO.AccessKey, APIAccessDTO.IsActive); apiAccess.ID = APIAccessDTO.ID; if (apiAccess.ID != Guid.Empty) { resultOperation = apiAccessService.Update(apiAccess); } else { resultOperation = apiAccessService.Add(apiAccess); } if (resultOperation.IsSuccess) { return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success)); } else { return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error)); } } }
public override bool IsAuthorized(AuthFilterContext context) { if (DomainUtility.IsTestEnvironment) { return(true); } using (APIAccessService apiAccessService = new APIAccessService()) { //when a client is calling main api ,they have to put token,which is password, in header named token if (context.ActionContext.Request.Headers.Contains("token")) { return(apiAccessService.HasAccess(ApiUtility.GetIPAddress(), context.ActionContext.Request.Headers.GetValues("token").FirstOrDefault())); } else { if (AccessUtility.CalledByLocalSA(HttpContext.Current.Request)) { //it is called from single action module in same server with same ip. return(true); } else { //when bpms user panel is calling engine api,every request should have formToken in its parameters. string formToken = context.ActionContext.RequestContext.Url.Request.GetHttpContext().Request.QueryString[FormTokenUtility.FormToken]; return(FormTokenUtility.ValidateFormToken(formToken, HttpContext.Current.Session.SessionID)); } } } }
protected override async Task OnInitializedAsync() { ConsumablesCollection = await APIAccessService.GetConsumablesCollectionAsync(); dataIsLoaded = true; await base.OnInitializedAsync(); }
public override bool IsAuthorized(AuthFilterContext context) { using (APIAccessService apiAccessService = new APIAccessService()) { return(DomainUtility.IsTestEnvironment ? true : FormTokenUtility.ValidateFormToken(context.ActionContext.RequestContext.Url.Request.GetHttpContext().Request.QueryString[FormTokenUtility.FormToken], HttpContext.Current.Session.SessionID)); } }
public object GetList([System.Web.Http.FromUri] APIAccessIndexSearchDTO indexSearchVM) { using (APIAccessService apiAccessService = new APIAccessService()) { indexSearchVM.Update(apiAccessService.GetList("", "", "", null, indexSearchVM.GetPagingProperties).Select(c => new APIAccessDTO(c)).ToList()); return(indexSearchVM); } }
public object GetActive(Guid ID) { using (APIAccessService apiAccessService = new APIAccessService()) { sysBpmsAPIAccess apiAccess = apiAccessService.GetInfo(ID); apiAccess.Update(true); ResultOperation resultOperation = apiAccessService.Update(apiAccess); } return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success)); }
public object GetAddEdit(Guid?ID = null) { using (APIAccessService apiAccessService = new APIAccessService()) { APIAccessDTO APIAccessDTO = ID.HasValue ? new APIAccessDTO(apiAccessService.GetInfo(ID.Value)) : new APIAccessDTO() { IsActive = true }; return(APIAccessDTO); } }
public object Delete(Guid ID) { using (APIAccessService apiAccessService = new APIAccessService()) { ResultOperation resultOperation = apiAccessService.Delete(ID); if (resultOperation.IsSuccess) { return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success)); } else { return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error)); } } }
public BpmsEngineApiControlBase() { using (ConfigurationService configurationService = new ConfigurationService()) { if (this.MyRequest.Headers.AllKeys.Contains("clientIp")) { this.ClientIp = this.MyRequest.Headers["clientIp"].ToStringObj(); } else { this.ClientIp = ApiUtility.GetIPAddress(); } //If it is called by bpms user panel module. if (!this.MyRequest.Headers.AllKeys.Contains("token") && !this.MyRequest.Headers.AllKeys.Contains("clientId")) { this.ClientUserName = DomainUtility.IsTestEnvironment ? "bpms_expert" : base.UserInfo.Username; this.ClientFormToken = this.MyRequest.QueryString[FormTokenUtility.FormToken].ToStringObj(); this.ClientId = HttpContext.Current.Session.SessionID; this.ApiSessionId = DomainUtility.CreateApiSessionID(this.ClientId, this.ClientIp); this.IsEncrypted = FormTokenUtility.GetIsEncrypted(this.ClientFormToken, this.ClientId); } else { if (this.MyRequest.Headers.AllKeys.Contains("userName")) { this.ClientUserName = this.MyRequest.Headers["userName"].ToStringObj(); } this.ClientId = this.MyRequest.Headers["clientId"].ToStringObj(); this.ApiSessionId = DomainUtility.CreateApiSessionID(this.ClientId, this.ClientIp);; //check api access. if (!AccessUtility.CalledByLocalSA(HttpContext.Current.Request)) { using (APIAccessService apiAccessService = new APIAccessService()) { if (!apiAccessService.HasAccess(ApiUtility.GetIPAddress(), this.MyRequest.Headers.GetValues("token").FirstOrDefault())) { throw new Exception("You are not authorized to access this application."); } } this.IsEncrypted = this.MyRequest.Headers["isEncrypted"].ToStringObj() == "1"; } } } }
public override bool IsAuthorized(AuthFilterContext context) { using (APIAccessService apiAccessService = new APIAccessService()) { if (DomainUtility.IsTestEnvironment) { return(true); } else { ModuleController mc = new ModuleController(); ModuleInfo mi = mc.GetModuleByDefinition(PortalController.Instance.GetCurrentPortalSettings().PortalId, AuthModuleFriendlyName); return(ModulePermissionController.CanViewModule(mi)); } } }
public BpmsCartableApiControlBase() { if (this.MyRequest.Headers.AllKeys.Contains("clientIp")) { this.ClientIp = this.MyRequest.Headers["clientIp"].ToStringObj(); } else { this.ClientIp = ApiUtility.GetIPAddress(); } using (APIAccessService apiAccessService = new APIAccessService()) { //api call using toke header,which is password, or formToken ,which is a parameter like antiforgerytoken cosist of sessionId and mainDynamicFormId encripted by sessionId. if (!this.MyRequest.Headers.AllKeys.Contains("token")) { this.ClientUserName = DomainUtility.IsTestEnvironment ? "bpms_expert" : base.UserInfo.Username; this.ClientFormToken = this.MyRequest.QueryString[FormTokenUtility.FormToken].ToStringObj(); this.ClientId = HttpContext.Current.Session.SessionID; this.ApiSessionId = DomainUtility.CreateApiSessionID(this.ClientId, this.ClientIp); this.IsEncrypted = FormTokenUtility.GetIsEncrypted(this.ClientFormToken, this.ClientId); } else { if (this.MyRequest.Headers.AllKeys.Contains("userName")) { this.ClientUserName = this.MyRequest.Headers["userName"].ToStringObj(); } this.ClientId = this.MyRequest.Headers["clientId"].ToStringObj(); this.ApiSessionId = DomainUtility.CreateApiSessionID(this.ClientId, this.ClientIp);; //set ApiSessionID if (!apiAccessService.HasAccess(ApiUtility.GetIPAddress(), this.MyRequest.Headers.GetValues("token").FirstOrDefault())) { throw new Exception("You are not authorized to access this application."); } this.IsEncrypted = this.MyRequest.Headers["isEncrypted"].ToStringObj() == "1"; } } }
public StockRepository(APIAccessService apiService) : base(apiService) { EndPointURI = "Stock/"; }
public BaseRepository(APIAccessService apiService, string endpointURI) { ApiService = apiService; Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes("admin" + ":" + "admin"))); EndPointURI = endpointURI; }