diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -602,6 +602,12 @@ class User(Base, BaseModel): return tokens.all() @property + def builtin_token_roles(self): + return map(UserApiKeys._get_role_name, [ + UserApiKeys.ROLE_API, UserApiKeys.ROLE_FEED, UserApiKeys.ROLE_HTTP + ]) + + @property def ip_addresses(self): ret = UserIpMap.query().filter(UserIpMap.user == self).all() return [x.ip_addr for x in ret] diff --git a/rhodecode/templates/admin/my_account/my_account_auth_tokens.html b/rhodecode/templates/admin/my_account/my_account_auth_tokens.html --- a/rhodecode/templates/admin/my_account/my_account_auth_tokens.html +++ b/rhodecode/templates/admin/my_account/my_account_auth_tokens.html @@ -10,11 +10,15 @@ - - -
${c.user.api_key}
- ${_('Built-in')} + + ${_('Built-in')} - all + + % for token in c.user.builtin_token_roles: + + ${token} + + % endfor ${_('expires')}: ${_('never')} @@ -34,8 +38,8 @@
${auth_token.api_key}
${auth_token.description} - ${auth_token.role_humanized} + + ${auth_token.role_humanized} %if auth_token.expires == -1: diff --git a/rhodecode/templates/admin/users/user_edit_auth_tokens.html b/rhodecode/templates/admin/users/user_edit_auth_tokens.html --- a/rhodecode/templates/admin/users/user_edit_auth_tokens.html +++ b/rhodecode/templates/admin/users/user_edit_auth_tokens.html @@ -11,7 +11,11 @@ ${_('Built-in')} - all + % for token in c.user.builtin_token_roles: + + ${token} + + % endfor ${_('expires')}: ${_('never')}