rbac/json/users.json
yumoqing 5712f4091e feat(users): admin reset password + clear login fail count for other users
- json/users.json: add 2 toolbar tools (selected_row) + script binds,
  same pattern as enable_user/disable_user; reset_password collects new
  password via prompt and POSTs JSON body to admin_reset_password.dspy
- api/admin_reset_password.dspy: orgid ownership check, min length 8,
  cfm match, password_encode (RC4), also resets login_fail counters,
  audit_log(password_reset), new password never logged
- api/clear_login_fail.dspy: ownership check, SET login_fail_count=0
  last_login_fail=NULL, audit_log(login_fail_clear)
- scripts/load_path.py: new PATHS_ADMIN section registered as *.admin
  (NOT logined - sensitive endpoints must not be open to any logged user)
2026-09-09 16:49:55 +08:00

94 lines
3.8 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"tblname": "users",
"title":"用户",
"params": {
"new_data_url": "{{entire_url('/rbac/api/add_user.dspy')}}",
"update_data_url": "{{entire_url('/rbac/api/update_user.dspy')}}",
"sortby":"username",
"confidential_fields":["password"],
"logined_userorgid":"orgid",
"browserfields": {
"exclouded": ["id", "password", "orgid", "nick_name" ],
"cwidth": {}
},
"editexclouded": ["id", "nick_name", "orgid", "last_login_fail", "last_login", "sync_from", "login_fail_count", "created_at"],
"toolbar": {
"tools": [
{
"selected_row": true,
"name": "reset_password",
"icon": "{{entire_url('/rbac/imgs/users.svg')}}",
"label": "重置密码"
},
{
"selected_row": true,
"name": "clear_login_fail",
"icon": "{{entire_url('/rbac/imgs/users.svg')}}",
"label": "清除登录次数"
}
]
},
"record_toolbar": [
{
"name": "enable_user",
"label": "启用",
"actiontype": "dspy",
"url": "/rbac/users/enable_user.dspy",
"options": {
"icon": "check",
"cwidth": 16,
"cheight": 9
}
},
{
"name": "disable_user",
"label": "禁用",
"actiontype": "dspy",
"url": "/rbac/users/disable_user.dspy",
"options": {
"icon": "block",
"cwidth": 16,
"cheight": 9
}
}
],
"binds": [
{
"wid": "self",
"event": "enable_user",
"actiontype": "script",
"target": "self",
"script": "var tid=bricks.getWidgetById('users_tbl');var d=tid.select_row.user_data;fetch('/rbac/users/enable_user.dspy?id='+d.id,{method:'POST'}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Message'){tid.render({})}else{bricks.show_error(r.options)}})"
},
{
"wid": "self",
"event": "disable_user",
"actiontype": "script",
"target": "self",
"script": "var tid=bricks.getWidgetById('users_tbl');var d=tid.select_row.user_data;fetch('/rbac/users/disable_user.dspy?id='+d.id,{method:'POST'}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Message'){tid.render({})}else{bricks.show_error(r.options)}})"
},
{
"wid": "self",
"event": "reset_password",
"actiontype": "script",
"target": "self",
"script": "var tid=bricks.getWidgetById('users_tbl');var d=tid.select_row.user_data;var np=prompt('为用户 '+d.username+' 设置新密码至少8位:');if(!np){return}var cp=prompt('再次输入以确认:');if(!cp){return}fetch('/rbac/api/admin_reset_password.dspy',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({userid:d.id,new_password:np,cfm_password:cp})}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Message'){bricks.show_message(r.options);tid.render({})}else{bricks.show_error(r.options)}})"
},
{
"wid": "self",
"event": "clear_login_fail",
"actiontype": "script",
"target": "self",
"script": "var tid=bricks.getWidgetById('users_tbl');var d=tid.select_row.user_data;fetch('/rbac/api/clear_login_fail.dspy?id='+d.id,{method:'POST'}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Message'){bricks.show_message(r.options);tid.render({})}else{bricks.show_error(r.options)}})"
}
],
"subtables": [
{
"field":"userid",
"title":"用户角色",
"subtable":"userrole"
}
]
}
}