public bool CheckPrivilegeWithLUserID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_SpecificUserId, bool includeCurrentUser) { bool ret = false; ret = _client.CheckPrivilegeWithLUserID(entity_WCFAuthInfoVM, str_SpecificUserId, includeCurrentUser); return(ret); }
public void DeleteFun() { fManageController.FunTypeKey = "Delete"; commonFixture.MockControllerInfo(fManageController, "http://localhost:50653/AccessControl/FManage/Delete"); WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, fManageController.FunKey, fManageController.FunTypeKey, this.commonFixture.LanguageKey.ToString(), ""); List <FunctionVM> entityList_FunVM = fManageController.funMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); Assert.NotEmpty(entityList_FunVM); FunctionVM entity_FunctionVM = entityList_FunVM.Where(current => current.FunctionPath == "1100").FirstOrDefault(); Assert.NotNull(entity_FunctionVM); FormCollection formCollection = new FormCollection(new NameValueCollection { { "ID", entity_FunctionVM.ID.ToString() } }); JsonResult jsonResult = (JsonResult)fManageController.Delete(formCollection); Assert.NotNull(jsonResult.Data); Assert.IsType <CommonJsonResult>(jsonResult.Data); Assert.True(((CommonJsonResult)jsonResult.Data).Success); }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FTID) { try { RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { ret = Respo_FT.Delete(str_FTID, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <string> GetOrgPathListByLUID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_UserID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_OrgPath_CheckUser = new List <string>(); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { strList_OrgPath_CheckUser = CoolUtilities.CoolLinqUtility.InnerJoin( dbContext.LUserAccessByOrgs.AsNoTracking().Where(current => current.UA_User_ID.ToString() == str_UserID).ToList(), dbContext.LUserOrganizations.AsNoTracking().ToList(), (left, right) => left.UA_Org_ID == right.ID, (left, right) => right).Select(current => current.LUO_Path).ToList(); }); } return(strList_OrgPath_CheckUser); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <FunctionVM> GetParentFunctions(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunKey) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <FunctionVM> entityList_Fun = new List <FunctionVM>(); if (entity_BaseSession != null) { //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionRespository Respo_F = new FunctionRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { entityList_Fun = Respo_F.GetParents(str_FunKey); } } return(entityList_Fun); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string ID) { WCFReturnResult ret = null; ret = _client.Delete(entity_WCFAuthInfoVM, ID); return(ret); }
public List <LUserRoleVM> GetAll(WCFAuthInfoVM entity_WCFAuthInfoVM) { List <LUserRoleVM> ret = new List <LUserRoleVM>(); ret = _client.GetAll(entity_WCFAuthInfoVM); return(ret); }
public LUSerListResult GetListWithPaging(WCFAuthInfoVM entity_WCFAuthInfoVM, LoginUserVM entity_SearchCriteria, int int_CurrentPage, int int_PageSize, string str_SortColumn, string str_SortDir, List <string> str_CustomFilter, List <Guid> guidList_AccessedLUserID) { LUSerListResult ret = null; ret = _client.GetListWithPaging(entity_WCFAuthInfoVM, entity_SearchCriteria, int_CurrentPage, int_PageSize, str_SortColumn, str_SortDir, str_CustomFilter, guidList_AccessedLUserID); return(ret); }
public LUSerEditResult GetEntityByIDWDetails(WCFAuthInfoVM entity_WCFAuthInfoVM, string UserID) { LUSerEditResult ret = null; ret = _client.GetEntityByIDWDetails(entity_WCFAuthInfoVM, UserID); return(ret); }
public SessionWUserInfo GetAuthInfo(WCFAuthInfoVM entity_WCFAuthInfoVM) { SessionWUserInfo ret = null; ret = _client.GetAuthInfo(entity_WCFAuthInfoVM); return(ret); }
public List <Guid> GetLUIDList(WCFAuthInfoVM entity_WCFAuthInfoVM, List <string> strList_Path) { List <Guid> ret = new List <Guid>(); ret = _client.GetLUIDList(entity_WCFAuthInfoVM, strList_Path); return(ret); }
public WCFReturnResult Logout(WCFAuthInfoVM entity_WCFAuthInfoVM) { WCFReturnResult ret = null; ret = _client.Logout(entity_WCFAuthInfoVM); return(ret); }
public WCFReturnResult ResetPwd(WCFAuthInfoVM entity_WCFAuthInfoVM, LoginUserVM entityInst) { WCFReturnResult ret = null; ret = _client.ResetPwd(entity_WCFAuthInfoVM, entityInst); return(ret); }
public void DeleteRole() { roleManageController.FunTypeKey = "Delete"; commonFixture.MockControllerInfo(roleManageController, "http://localhost:50653/AccessControl/LURoleManage/Delete"); WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, roleManageController.FunKey, roleManageController.FunTypeKey, this.commonFixture.LanguageKey.ToString(), ""); List <LUserRoleVM> entityList_OrgVM = roleManageController.roleMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); Assert.NotEmpty(entityList_OrgVM); LUserRoleVM entity_RoleVM = entityList_OrgVM.Where(current => current.RoleName.IndexOf("Test") == 0).FirstOrDefault(); Assert.NotNull(entity_RoleVM); FormCollection formCollection = new FormCollection(new NameValueCollection { { "ID", entity_RoleVM.ID.ToString() } }); JsonResult jsonResult = (JsonResult)roleManageController.Delete(formCollection); Assert.NotNull(jsonResult.Data); Assert.IsType <CommonJsonResult>(jsonResult.Data); Assert.True(((CommonJsonResult)jsonResult.Data).Success); }
public RoleSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_ID) { RoleSerEditResult ret = null; ret = _client.GetEntityByID(entity_WCFAuthInfoVM, str_ID); return(ret); }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, LoginUserVM loginUserVM) { WCFReturnResult ret = null; ret = _client.Update(entity_WCFAuthInfoVM, loginUserVM); return(ret); }
public List <LUserRoleVM> GetEntityListByIDList(WCFAuthInfoVM entity_WCFAuthInfoVM, List <string> strList_ID) { List <LUserRoleVM> ret = new List <LUserRoleVM>(); ret = _client.GetEntityListByIDList(entity_WCFAuthInfoVM, strList_ID); return(ret); }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, FunctionTypeVM functionTypeVM) { WCFReturnResult ret = null; ret = _client.Update(entity_WCFAuthInfoVM, functionTypeVM); return(ret); }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserRoleVM roleVM) { WCFReturnResult ret = null; ret = _client.Update(entity_WCFAuthInfoVM, roleVM); return(ret); }
public List <FunctionTypeVM> GetAllFunType(WCFAuthInfoVM entity_WCFAuthInfoVM) { List <FunctionTypeVM> ret = new List <FunctionTypeVM>(); ret = _client.GetAllFunType(entity_WCFAuthInfoVM); return(ret); }
public List <LUserOrganizationVM> GetAll(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LUserOrganizationRespository orgRespo = new LUserOrganizationRespository(dbContext, entity_BaseSession.ID); List <LUserOrganizationVM> entityList_OrgVM = new List <LUserOrganizationVM>(); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { entityList_OrgVM = orgRespo.GetLUOrgVM_All(); } return(entityList_OrgVM); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public void DeleteOrgDetails() { orgDetailsMgtController.FunTypeKey = "Delete"; commonFixture.MockControllerInfo(orgDetailsMgtController, "http://localhost:50653/AccessControl/LUOrgDetailsManage/Delete"); WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, orgDetailsMgtController.FunKey, orgDetailsMgtController.FunTypeKey, this.commonFixture.LanguageKey.ToString(), ""); List <LUserOrgDetailsVM> entityList_OrgDetailsVM = orgDetailsMgtController.orgDetailMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); Assert.NotEmpty(entityList_OrgDetailsVM); entityList_OrgDetailsVM = entityList_OrgDetailsVM.Where(current => current.OrgDetailsKey.IndexOf("Test") == 0).ToList(); Assert.NotEmpty(entityList_OrgDetailsVM); foreach (var entity_OrgDetailsVM in entityList_OrgDetailsVM) { FormCollection formCollection = new FormCollection(new NameValueCollection { { "ID", entity_OrgDetailsVM.ID.ToString() } }); JsonResult jsonResult = (JsonResult)orgDetailsMgtController.Delete(formCollection); Assert.NotNull(jsonResult.Data); Assert.IsType <CommonJsonResult>(jsonResult.Data); Assert.True(((CommonJsonResult)jsonResult.Data).Success); } }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserOrgDetailsVM entity_OrgDetailsVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); OrgDRespository Respo_OrgD = new OrgDRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { ret = Respo_OrgD.Update(entity_OrgDetailsVM, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public OrgDetailsMgtControllerTest(CommonFixture commonFixture) { this.commonFixture = commonFixture; //Generate Token commonFixture.LoginAndGetToken(); orgDetailsMgtController = new LUOrgDetailsManageController(Bootstrapper.Container); orgDetailsMgtController.ServiceAuthorizedKey = commonFixture.StrToken; FunMgtHelper funMgtHelper = Bootstrapper.Container.GetExportedValue <FunMgtHelper>(); OrgDetailMgtHelper orgDetailMgtHelper = Bootstrapper.Container.GetExportedValue <OrgDetailMgtHelper>(); RoleMgtHelper roleMgtHelper = Bootstrapper.Container.GetExportedValue <RoleMgtHelper>(); orgDetailsMgtController.funMgtHelper = new Lazy <FunMgtHelper>(() => funMgtHelper); orgDetailsMgtController.orgDetailMgtHelper = new Lazy <OrgDetailMgtHelper>(() => orgDetailMgtHelper); orgDetailsMgtController.roleMgtHelper = new Lazy <RoleMgtHelper>(() => roleMgtHelper); orgDetailsMgtController.TempData[StaticContent.LanguageKey] = this.commonFixture.LanguageKey; orgDetailsMgtController.FunKey = "LUOrgDetailsManage"; orgDetailsMgtController.FunTypeKey = "Create"; #region [ Initialize List ] WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, orgDetailsMgtController.FunKey, orgDetailsMgtController.FunTypeKey, this.commonFixture.LanguageKey.ToString(), ""); //All Fun entityList_FunVM = orgDetailsMgtController.funMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); //All Role entityList_RoleVM = orgDetailsMgtController.roleMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); #endregion }
public FSerEditResult GetEmptyFVM(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Restore Server Session by token RetrieveServerSideSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); FSerEditResult returnResult = new FSerEditResult(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { returnResult.Entity_FunctionVM = new FunctionVM(); } returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public bool CheckPrivilege(WCFAuthInfoVM entity_WCFAuthInfoVM, bool isCheckFunType) { try { bool ret = false; RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); if (!isCheckFunType) { ret = CheckAccPrivilege(entity_BaseSession.ID, ref strList_Error); } else { ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); } return(ret); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public FunMgtControllerTest(CommonFixture commonFixture) { this.commonFixture = commonFixture; //Generate Token commonFixture.LoginAndGetToken(); FunTypeMgtHelper funTypeMgtHelper = Bootstrapper.Container.GetExportedValue <FunTypeMgtHelper>(); FunMgtHelper funMgtHelper = Bootstrapper.Container.GetExportedValue <FunMgtHelper>(); fManageController = new FManageController(Bootstrapper.Container); fManageController.ServiceAuthorizedKey = commonFixture.StrToken; fManageController.funTypeMgtHelper = new Lazy <FunTypeMgtHelper>(() => funTypeMgtHelper); fManageController.funMgtHelper = new Lazy <FunMgtHelper>(() => funMgtHelper); fManageController.TempData[StaticContent.LanguageKey] = this.commonFixture.LanguageKey; fManageController.FunKey = "FManage"; WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, fManageController.FunKey, "Create", this.commonFixture.LanguageKey.ToString(), ""); entityList_FunTypeVM = funTypeMgtHelper.GetAllFunType(entity_WCFAuthInfoVM); }
public RoleSerListResult GetListWithPaging(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserRoleVM entity_SearchCriteria, int int_CurrentPage, int int_PageSize, string str_SortColumn, string str_SortDir, List <string> str_CustomFilter) { RoleSerListResult ret = null; ret = _client.GetListWithPaging(entity_WCFAuthInfoVM, entity_SearchCriteria, int_CurrentPage, int_PageSize, str_SortColumn, str_SortDir, str_CustomFilter); return(ret); }
public List <FunctionTypeVM> GetAllFunType(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <FunctionTypeVM> returnResult = new List <FunctionTypeVM>(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { returnResult = Respo_FT.GetAllFunctionType(); } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public bool CheckPrivilege(WCFAuthInfoVM entity_WCFAuthInfoVM, bool isCheckFunType) { bool ret = false; ret = _client.CheckPrivilege(entity_WCFAuthInfoVM, isCheckFunType); return(ret); }