diff --git a/rbac/check_perm.py b/rbac/check_perm.py index 51515ee..8a96863 100644 --- a/rbac/check_perm.py +++ b/rbac/check_perm.py @@ -43,7 +43,7 @@ def get_apikey_from_token(token): return None async def get_user_roles(userid): - sql = "select concat(b.orgtypeid, '.' b.name) as name from userrole a, role b where a.userid=${userid}$ and a.roleid = b.id" + sql = "select concat(b.orgtypeid, '.', b.name) as name from userrole a, role b where a.userid=${userid}$ and a.roleid = b.id" db = DBPools() roles = [] dbname = await get_dbname() diff --git a/wwwroot/user/myrole.ui b/wwwroot/user/myrole.ui new file mode 100644 index 0000000..e661030 --- /dev/null +++ b/wwwroot/user/myrole.ui @@ -0,0 +1,27 @@ +{ + "widgettype":"VBox", + "options":{ + "height":"100%" + }, + "subwidgets":[ + { + "widgettype":"Title4", + "options":{ + "otext":"我的角色", + "i18n":true + } + }, +{% set roles = get_user_roles(get_user()) %} +{% for role in roles %} + { + "widgettype":"Text", + "options":{ + "text":"{{role}}" + } + }, +{% endfor %} + { + "oops":true + } + ] +} diff --git a/wwwroot/user/user.ui b/wwwroot/user/user.ui index 5b5b4cf..fa55e87 100644 --- a/wwwroot/user/user.ui +++ b/wwwroot/user/user.ui @@ -3,7 +3,7 @@ "widgettype":"HBox", "options":{ "css":"clickable", - "cwidth":14 + "cwidth":12 }, "binds":[ { @@ -31,8 +31,7 @@ { "widgettype":"Text", "options":{ - "wrap":false, - "text":"{{get_username()}}({{str(get_user_roles(get_user()))}})" + "text":"{{get_username()}}" } } ] diff --git a/wwwroot/user/user_menu.ui b/wwwroot/user/user_menu.ui index 3d8ceb6..9b072d2 100644 --- a/wwwroot/user/user_menu.ui +++ b/wwwroot/user/user_menu.ui @@ -1,7 +1,12 @@ { "widgettype":"Menu", "options":{ + "cwidth":10, "target":"PopupWindow", + "popup_options":{ + "height":"70%", + "width":"70%" + }, "items":[ {% if 'customer' in get_user_roles(get_user()) %} {