rbac/wwwroot/add_adminuser.dspy
2024-11-10 15:01:02 +08:00

20 lines
486 B
Plaintext

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())