Commit b8994f6a by 蒋勇

d

parent 565e22a3
......@@ -59,11 +59,18 @@ class UserService extends ServiceBase {
//设置默认角色,租户
//设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
//如果是非租户,那么按照当前应用ID是找不到指定的角色,所以是空的
var roles = await self.roleDao.model.findAll({ where: { id: { [self.db.Op.in]: rolecodes }, app_id: roleappid, company_id: p.company_id }, transaction: t });
if (roles && roles.length > 0) {
await u.setRoles(roles, { transaction: t });
if(p.isAdmin){
var roles = await self.roleDao.model.findAll({ where: { id: { [self.db.Op.in]: rolecodes }, app_id: roleappid, company_id: settings.pmcompanyid}, transaction: t });
if (roles && roles.length > 0) {
await u.setRoles(roles, { transaction: t });
}
}else{
var roles = await self.roleDao.model.findAll({ where: { id: { [self.db.Op.in]: rolecodes }, app_id: roleappid, company_id: p.company_id}, transaction: t });
if (roles && roles.length > 0) {
await u.setRoles(roles, { transaction: t });
}
}
//创建统一账号 to add extra fields
let cred = await self.cregister(u.userName, p.company_id, p.password, u.id + "")
console.log("......................................");
......
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