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.
This commit is contained in:
parent
fcc027c282
commit
1e5cfcf8ab
3 changed files with 21 additions and 7 deletions
|
|
@ -601,6 +601,12 @@ class User(Base, BaseModel):
|
|||
UserApiKeys.role == UserApiKeys.ROLE_ALL))
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -10,11 +10,15 @@
|
|||
<table class="rctable auth_tokens">
|
||||
<tr>
|
||||
<td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${c.user.api_key}</code></div></td>
|
||||
<td class="td-buttons">
|
||||
<span class="btn btn-mini btn-info disabled">${_('Built-in')}</span>
|
||||
<td class="td-tags">
|
||||
<span class="tag disabled">${_('Built-in')}</span>
|
||||
</td>
|
||||
<td class="td-buttons">
|
||||
<span class="btn btn-mini btn-info disabled">all</span>
|
||||
<td class="td-tags">
|
||||
% for token in c.user.builtin_token_roles:
|
||||
<span class="tag disabled">
|
||||
${token}
|
||||
</span>
|
||||
% endfor
|
||||
</td>
|
||||
<td class="td-exp">${_('expires')}: ${_('never')}</td>
|
||||
<td class="td-action">
|
||||
|
|
@ -34,8 +38,8 @@
|
|||
<tr class="${'expired' if auth_token.expired else ''}">
|
||||
<td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
|
||||
<td class="td-wrap">${auth_token.description}</td>
|
||||
<td class="td-buttons">
|
||||
<span class="btn btn-mini btn-info disabled">${auth_token.role_humanized}</span>
|
||||
<td class="td-tags">
|
||||
<span class="tag disabled">${auth_token.role_humanized}</span>
|
||||
</td>
|
||||
<td class="td-exp">
|
||||
%if auth_token.expires == -1:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@
|
|||
<span class="tag disabled">${_('Built-in')}</span>
|
||||
</td>
|
||||
<td class="td-tags">
|
||||
<span class="tag disabled">all</span>
|
||||
% for token in c.user.builtin_token_roles:
|
||||
<span class="tag disabled">
|
||||
${token}
|
||||
</span>
|
||||
% endfor
|
||||
</td>
|
||||
<td class="td-exp">${_('expires')}: ${_('never')}</td>
|
||||
<td class="td-action">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue