Show More
@@ -1130,10 +1130,10 b' class UserApiKeys(Base, BaseModel):' | |||||
1130 |
|
1130 | |||
1131 | def _get_scope(self): |
|
1131 | def _get_scope(self): | |
1132 | if self.repo: |
|
1132 | if self.repo: | |
1133 |
return |
|
1133 | return 'Repository: {}'.format(self.repo.repo_name) | |
1134 | if self.repo_group: |
|
1134 | if self.repo_group: | |
1135 | return repr(self.repo_group) + ' (recursive)' |
|
1135 | return 'RepositoryGroup: {} (recursive)'.format(self.repo_group.group_name) | |
1136 |
return ' |
|
1136 | return 'Global' | |
1137 |
|
1137 | |||
1138 | @property |
|
1138 | @property | |
1139 | def scope_humanized(self): |
|
1139 | def scope_humanized(self): |
@@ -1,35 +1,36 b'' | |||||
1 | <div class="panel panel-default"> |
|
1 | <div class="panel panel-default"> | |
2 | <div class="panel-heading"> |
|
2 | <div class="panel-heading"> | |
3 | <h3 class="panel-title">${_('Authentication Tokens')}</h3> |
|
3 | <h3 class="panel-title">${_('Authentication Tokens')}</h3> | |
4 | </div> |
|
4 | </div> | |
5 | <div class="panel-body"> |
|
5 | <div class="panel-body"> | |
6 | <div class="apikeys_wrap"> |
|
6 | <div class="apikeys_wrap"> | |
7 | <p> |
|
7 | <p> | |
8 | ${_('Each token can have a role. Token with a role can be used only in given context, ' |
|
8 | ${_('Authentication tokens can be used to interact with the API, or VCS-over-http. ' | |
|
9 | 'Each token can have a role. Token with a role can be used only in given context, ' | |||
9 | 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')} |
|
10 | 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')} | |
10 | </p> |
|
11 | </p> | |
11 | <table class="rctable auth_tokens"> |
|
12 | <table class="rctable auth_tokens"> | |
12 | <tr> |
|
13 | <tr> | |
13 | <th>${_('Token')}</th> |
|
14 | <th>${_('Token')}</th> | |
14 | <th>${_('Scope')}</th> |
|
|||
15 | <th>${_('Description')}</th> |
|
15 | <th>${_('Description')}</th> | |
16 | <th>${_('Role')}</th> |
|
16 | <th>${_('Role')}</th> | |
|
17 | <th>${_('Repository Scope')}</th> | |||
17 | <th>${_('Expiration')}</th> |
|
18 | <th>${_('Expiration')}</th> | |
18 | <th>${_('Action')}</th> |
|
19 | <th>${_('Action')}</th> | |
19 | </tr> |
|
20 | </tr> | |
20 | %if c.user_auth_tokens: |
|
21 | %if c.user_auth_tokens: | |
21 | %for auth_token in c.user_auth_tokens: |
|
22 | %for auth_token in c.user_auth_tokens: | |
22 | <tr class="${'expired' if auth_token.expired else ''}"> |
|
23 | <tr class="${('expired' if auth_token.expired else '')}"> | |
23 | <td class="truncate-wrap td-authtoken"> |
|
24 | <td class="truncate-wrap td-authtoken"> | |
24 | <div class="user_auth_tokens truncate autoexpand"> |
|
25 | <div class="user_auth_tokens truncate autoexpand"> | |
25 | <code>${auth_token.api_key}</code> |
|
26 | <code>${auth_token.api_key}</code> | |
26 | </div> |
|
27 | </div> | |
27 | </td> |
|
28 | </td> | |
28 | <td class="td">${auth_token.scope_humanized}</td> |
|
|||
29 | <td class="td-wrap">${auth_token.description}</td> |
|
29 | <td class="td-wrap">${auth_token.description}</td> | |
30 | <td class="td-tags"> |
|
30 | <td class="td-tags"> | |
31 | <span class="tag disabled">${auth_token.role_humanized}</span> |
|
31 | <span class="tag disabled">${auth_token.role_humanized}</span> | |
32 | </td> |
|
32 | </td> | |
|
33 | <td class="td">${auth_token.scope_humanized}</td> | |||
33 | <td class="td-exp"> |
|
34 | <td class="td-exp"> | |
34 | %if auth_token.expires == -1: |
|
35 | %if auth_token.expires == -1: | |
35 | ${_('never')} |
|
36 | ${_('never')} | |
@@ -58,40 +59,41 b'' | |||||
58 | </table> |
|
59 | </table> | |
59 | </div> |
|
60 | </div> | |
60 |
|
61 | |||
61 |
|
|
62 | <div class="user_auth_tokens"> | |
62 |
|
|
63 | ${h.secure_form(h.route_path('my_account_auth_tokens_add'), request=request)} | |
63 |
|
|
64 | <div class="form form-vertical"> | |
64 |
|
|
65 | <!-- fields --> | |
65 |
|
|
66 | <div class="fields"> | |
66 |
|
|
67 | <div class="field"> | |
67 |
|
|
68 | <div class="label"> | |
68 |
|
|
69 | <label for="new_email">${_('New authentication token')}:</label> | |
69 |
|
|
70 | </div> | |
70 |
|
|
71 | <div class="input"> | |
71 |
|
|
72 | ${h.text('description', class_='medium', placeholder=_('Description'))} | |
72 |
|
|
73 | ${h.hidden('lifetime')} | |
73 |
|
|
74 | ${h.select('role', '', c.role_options)} | |
74 |
|
75 | |||
75 |
|
|
76 | % if c.allow_scoped_tokens: | |
76 |
|
|
77 | ${h.hidden('scope_repo_id')} | |
77 |
|
|
78 | % else: | |
78 |
|
|
79 | ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')} | |
79 |
|
|
80 | % endif | |
80 | </div> |
|
|||
81 | <p class="help-block"> |
|
|||
82 | ${_('Repository scope works only with tokens with VCS type.')} |
|
|||
83 | </p> |
|
|||
84 | </div> |
|
|||
85 | <div class="buttons"> |
|
|||
86 | ${h.submit('save',_('Add'),class_="btn")} |
|
|||
87 | ${h.reset('reset',_('Reset'),class_="btn")} |
|
|||
88 | </div> |
|
81 | </div> | |
|
82 | <p class="help-block"> | |||
|
83 | ${_('Repository scope works only with tokens with VCS type.')} | |||
|
84 | </p> | |||
|
85 | </div> | |||
|
86 | <div class="buttons"> | |||
|
87 | ${h.submit('save',_('Add'),class_="btn")} | |||
|
88 | ${h.reset('reset',_('Reset'),class_="btn")} | |||
89 | </div> |
|
89 | </div> | |
90 | </div> |
|
90 | </div> | |
91 | ${h.end_form()} |
|
|||
92 | </div> |
|
91 | </div> | |
|
92 | ${h.end_form()} | |||
|
93 | </div> | |||
93 | </div> |
|
94 | </div> | |
94 | </div> |
|
95 | </div> | |
|
96 | ||||
95 | <script> |
|
97 | <script> | |
96 | $(document).ready(function(){ |
|
98 | $(document).ready(function(){ | |
97 |
|
99 |
@@ -5,27 +5,32 b'' | |||||
5 | <div class="panel-body"> |
|
5 | <div class="panel-body"> | |
6 | <div class="apikeys_wrap"> |
|
6 | <div class="apikeys_wrap"> | |
7 | <p> |
|
7 | <p> | |
8 | ${_('Each token can have a role. Token with a role can be used only in given context, ' |
|
8 | ${_('Authentication tokens can be used to interact with the API, or VCS-over-http. ' | |
|
9 | 'Each token can have a role. Token with a role can be used only in given context, ' | |||
9 | 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')} |
|
10 | 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')} | |
10 | </p> |
|
11 | </p> | |
11 | <table class="rctable auth_tokens"> |
|
12 | <table class="rctable auth_tokens"> | |
12 | <tr> |
|
13 | <tr> | |
13 | <th>${_('Token')}</th> |
|
14 | <th>${_('Token')}</th> | |
14 | <th>${_('Scope')}</th> |
|
|||
15 | <th>${_('Description')}</th> |
|
15 | <th>${_('Description')}</th> | |
16 | <th>${_('Role')}</th> |
|
16 | <th>${_('Role')}</th> | |
|
17 | <th>${_('Repository Scope')}</th> | |||
17 | <th>${_('Expiration')}</th> |
|
18 | <th>${_('Expiration')}</th> | |
18 | <th>${_('Action')}</th> |
|
19 | <th>${_('Action')}</th> | |
19 | </tr> |
|
20 | </tr> | |
20 | %if c.user_auth_tokens: |
|
21 | %if c.user_auth_tokens: | |
21 | %for auth_token in c.user_auth_tokens: |
|
22 | %for auth_token in c.user_auth_tokens: | |
22 | <tr class="${'expired' if auth_token.expired else ''}"> |
|
23 | <tr class="${('expired' if auth_token.expired else '')}"> | |
23 | <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td> |
|
24 | <td class="truncate-wrap td-authtoken"> | |
24 |
< |
|
25 | <div class="user_auth_tokens truncate autoexpand"> | |
|
26 | <code>${auth_token.api_key}</code> | |||
|
27 | </div> | |||
|
28 | </td> | |||
25 | <td class="td-wrap">${auth_token.description}</td> |
|
29 | <td class="td-wrap">${auth_token.description}</td> | |
26 | <td class="td-tags"> |
|
30 | <td class="td-tags"> | |
27 | <span class="tag disabled">${auth_token.role_humanized}</span> |
|
31 | <span class="tag disabled">${auth_token.role_humanized}</span> | |
28 | </td> |
|
32 | </td> | |
|
33 | <td class="td">${auth_token.scope_humanized}</td> | |||
29 | <td class="td-exp"> |
|
34 | <td class="td-exp"> | |
30 | %if auth_token.expires == -1: |
|
35 | %if auth_token.expires == -1: | |
31 | ${_('never')} |
|
36 | ${_('never')} |
General Comments 0
You need to be logged in to leave comments.
Login now