- reset_password: urlwidget + PopupWindow Form (same pattern as userrole),
hidden userid field from params_kw, password fields with required validation
- clear_login_fail: urlwidget + conform dialog, params_mapping id only
- fixes runtime crash: script bind called bricks.getWidgetById('users_tbl')
without from_widget context -> TypeError on dom_element
- register /rbac/admin_reset_password.ui in PATHS_ADMIN (admin role only)
- i18n entries for 4 languages
118 lines
4.2 KiB
JSON
118 lines
4.2 KiB
JSON
{
|
|
"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": "urlwidget",
|
|
"target": "PopupWindow",
|
|
"popup_options": {
|
|
"title": "重置密码",
|
|
"resizable": true,
|
|
"height": "60%",
|
|
"width": "40%"
|
|
},
|
|
"options": {
|
|
"method": "POST",
|
|
"params": {},
|
|
"url": "{{entire_url('/rbac/admin_reset_password.ui')}}"
|
|
}
|
|
},
|
|
{
|
|
"wid": "self",
|
|
"event": "clear_login_fail",
|
|
"actiontype": "urlwidget",
|
|
"target": "self",
|
|
"conform": {
|
|
"title": "清除登录次数",
|
|
"message": "确认清除该用户的连续登录失败次数?"
|
|
},
|
|
"options": {
|
|
"method": "POST",
|
|
"params": {},
|
|
"url": "{{entire_url('/rbac/api/clear_login_fail.dspy')}}"
|
|
},
|
|
"params_mapping": {
|
|
"mapping": {
|
|
"id": "id"
|
|
},
|
|
"need_others": false
|
|
}
|
|
}
|
|
],
|
|
"subtables": [
|
|
{
|
|
"field":"userid",
|
|
"title":"用户角色",
|
|
"subtable":"userrole"
|
|
}
|
|
]
|
|
}
|
|
}
|