# HG changeset patch # User Marcin Kuzminski # Date 2017-01-02 09:18:47 # Node ID 35c9ce2a4bdd9e9b41a8790c05a87ac1487e093a # Parent 47a44c03532d986fe0e93ace592536cb39ec515a auth-tokens: show all available roles for the builtin token. - builtin token cannot be used to make VCS calls, we wrongly identified it as ALL token. 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')}