Commit 58c677d2 by 蒋勇

d

parent 4e62dab9
......@@ -7,7 +7,18 @@ class UserCtl extends CtlBase {
constructor() {
super("auth", CtlBase.getServiceName(UserCtl));
}
async pmgetUserByCode(pobj, qobj, req){
let code=pobj.code
let rtn=await this.service.pmgetUserByCode(code)
return system.getResult(rtn)
}
async loginApp(pobj, qobj, req){
let appkey=pobj.appkey
let uname=pobj.username
let rtn=await this.service.loginApp(appkey,uname)
return system.getResult(rtn);
}
async resetPassword(pobj, qobj, req){
await this.service.resetPassword(req.xctx.username,pobj.onepassword)
return system.getResult({});
......
......@@ -9,7 +9,31 @@ class UserService extends ServiceBase {
this.roleDao = system.getObject("db.auth.roleDao");
this.authS=system.getObject("service.auth.authSve");
}
async pmgetUserByCode(code){
let ux= await this.cacheManager["UserCache"].getCache(code);
return ux;
}
async loginApp(appkey,uname){
let rtn={}
let app= await this.cacheManager["AppCache"].cache(appkey);
let url=app.homePage
let userLogined= this.cacheManager["UserCache"].cache(uname);
rtn.user=userLogined
if (userLogined) {
let token = await self.cmakejwt(userLogined.jwtkey, userLogined.jwtsecret, null);
rtn.token = token;
}
let roleids=userLogined.Roles.map(item=>{
return item.id
})
let auths= await this.authS.findAuthsByRole(roleids)
rtn.user.access=auths
let code=this.getUUID()
this.cacheManager["UserCache"].cache(code,rtn,60000);
let url=app.homePage+"?code="+code
return {url:url};
}
//登录后的租户创建属于租户的用户
//需要在控制器里取出公司ID
//和租户绑定同一家公司
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment