rbac/wwwroot/add_adminuser.dspy

20 lines
486 B
Plaintext
Raw Normal View History

2024-11-10 15:01:02 +08:00
if params_kw.get('password') != params_kw.get('chkpassword'):
return Error(title='add user error', message='password not match')
ns = params_kw.copy()
ns['id'] = uuid()
await rfexe('passowrd', ns)
user_orgid = await get_user_orgid()
ns['orgid'] = user_orgid
dbname = rfexe('get_module_dbname','rbac')
async db.sqlorConext(dbname) as sor:
await sor.C('users',ns.copy())
uid = ns['id']
ns = {
'id':uuid(),
'userid':uid,
'roleid':'admin'
}
await sor.C('userrole', ns.copy())