##// END OF EJS Templates
auth-tokens: show all available roles for the builtin token....
marcink -
r1272:35c9ce2a default
parent child Browse files
Show More
@@ -602,6 +602,12 b' class User(Base, BaseModel):'
602 return tokens.all()
602 return tokens.all()
603
603
604 @property
604 @property
605 def builtin_token_roles(self):
606 return map(UserApiKeys._get_role_name, [
607 UserApiKeys.ROLE_API, UserApiKeys.ROLE_FEED, UserApiKeys.ROLE_HTTP
608 ])
609
610 @property
605 def ip_addresses(self):
611 def ip_addresses(self):
606 ret = UserIpMap.query().filter(UserIpMap.user == self).all()
612 ret = UserIpMap.query().filter(UserIpMap.user == self).all()
607 return [x.ip_addr for x in ret]
613 return [x.ip_addr for x in ret]
@@ -10,11 +10,15 b''
10 <table class="rctable auth_tokens">
10 <table class="rctable auth_tokens">
11 <tr>
11 <tr>
12 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${c.user.api_key}</code></div></td>
12 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${c.user.api_key}</code></div></td>
13 <td class="td-buttons">
13 <td class="td-tags">
14 <span class="btn btn-mini btn-info disabled">${_('Built-in')}</span>
14 <span class="tag disabled">${_('Built-in')}</span>
15 </td>
15 </td>
16 <td class="td-buttons">
16 <td class="td-tags">
17 <span class="btn btn-mini btn-info disabled">all</span>
17 % for token in c.user.builtin_token_roles:
18 <span class="tag disabled">
19 ${token}
20 </span>
21 % endfor
18 </td>
22 </td>
19 <td class="td-exp">${_('expires')}: ${_('never')}</td>
23 <td class="td-exp">${_('expires')}: ${_('never')}</td>
20 <td class="td-action">
24 <td class="td-action">
@@ -34,8 +38,8 b''
34 <tr class="${'expired' if auth_token.expired else ''}">
38 <tr class="${'expired' if auth_token.expired else ''}">
35 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
39 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
36 <td class="td-wrap">${auth_token.description}</td>
40 <td class="td-wrap">${auth_token.description}</td>
37 <td class="td-buttons">
41 <td class="td-tags">
38 <span class="btn btn-mini btn-info disabled">${auth_token.role_humanized}</span>
42 <span class="tag disabled">${auth_token.role_humanized}</span>
39 </td>
43 </td>
40 <td class="td-exp">
44 <td class="td-exp">
41 %if auth_token.expires == -1:
45 %if auth_token.expires == -1:
@@ -11,7 +11,11 b''
11 <span class="tag disabled">${_('Built-in')}</span>
11 <span class="tag disabled">${_('Built-in')}</span>
12 </td>
12 </td>
13 <td class="td-tags">
13 <td class="td-tags">
14 <span class="tag disabled">all</span>
14 % for token in c.user.builtin_token_roles:
15 <span class="tag disabled">
16 ${token}
17 </span>
18 % endfor
15 </td>
19 </td>
16 <td class="td-exp">${_('expires')}: ${_('never')}</td>
20 <td class="td-exp">${_('expires')}: ${_('never')}</td>
17 <td class="td-action">
21 <td class="td-action">
General Comments 0
You need to be logged in to leave comments. Login now