##// END OF EJS Templates
ssh: improve logging, and make the UI show last accessed date for key.
marcink -
r2973:40c25cc7 default
parent child Browse files
Show More
@@ -62,7 +62,8 b' class SshWrapper(object):'
62 key.accessed_on = datetime.datetime.utcnow()
62 key.accessed_on = datetime.datetime.utcnow()
63 Session().add(key)
63 Session().add(key)
64 Session().commit()
64 Session().commit()
65 log.debug('Update key `%s` access time', key_id)
65 log.debug('Update key id:`%s` fingerprint:`%s` access time',
66 key_id, key.ssh_key_fingerprint)
66
67
67 def get_connection_info(self):
68 def get_connection_info(self):
68 """
69 """
@@ -70,6 +70,11 b' class VcsServer(object):'
70 'permission for %s on %s are: %s',
70 'permission for %s on %s are: %s',
71 self.user, self.repo_name, permission)
71 self.user, self.repo_name, permission)
72
72
73 if not permission:
74 log.error('user `%s` permissions to repo:%s are empty. Forbidding access.',
75 self.user, self.repo_name)
76 return -2
77
73 if action == 'pull':
78 if action == 'pull':
74 if permission in self.read_perms:
79 if permission in self.read_perms:
75 log.info(
80 log.info(
@@ -83,8 +88,8 b' class VcsServer(object):'
83 self.user, self.repo_name)
88 self.user, self.repo_name)
84 return 0
89 return 0
85
90
86 log.error('Cannot properly fetch or allow user %s permissions. '
91 log.error('Cannot properly fetch or verify user `%s` permissions. '
87 'Return value is: %s, req action: %s',
92 'Permissions: %s, vcs action: %s',
88 self.user, permission, action)
93 self.user, permission, action)
89 return -2
94 return -2
90
95
@@ -8,7 +8,8 b''
8 <tr>
8 <tr>
9 <th>${_('Fingerprint')}</th>
9 <th>${_('Fingerprint')}</th>
10 <th>${_('Description')}</th>
10 <th>${_('Description')}</th>
11 <th>${_('Created')}</th>
11 <th>${_('Created on')}</th>
12 <th>${_('Accessed on')}</th>
12 <th>${_('Action')}</th>
13 <th>${_('Action')}</th>
13 </tr>
14 </tr>
14 % if not c.ssh_enabled:
15 % if not c.ssh_enabled:
@@ -22,6 +23,7 b''
22 </td>
23 </td>
23 <td class="td-wrap">${ssh_key.description}</td>
24 <td class="td-wrap">${ssh_key.description}</td>
24 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
25 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
26 <td class="td-tags">${h.format_date(ssh_key.accessed_on)}</td>
25
27
26 <td class="td-action">
28 <td class="td-action">
27 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
29 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
@@ -8,7 +8,8 b''
8 <tr>
8 <tr>
9 <th>${_('Fingerprint')}</th>
9 <th>${_('Fingerprint')}</th>
10 <th>${_('Description')}</th>
10 <th>${_('Description')}</th>
11 <th>${_('Created')}</th>
11 <th>${_('Created on')}</th>
12 <th>${_('Accessed on')}</th>
12 <th>${_('Action')}</th>
13 <th>${_('Action')}</th>
13 </tr>
14 </tr>
14 %if c.user_ssh_keys:
15 %if c.user_ssh_keys:
@@ -19,6 +20,7 b''
19 </td>
20 </td>
20 <td class="td-wrap">${ssh_key.description}</td>
21 <td class="td-wrap">${ssh_key.description}</td>
21 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
22 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
23 <td class="td-tags">${h.format_date(ssh_key.accessed_on)}</td>
22
24
23 <td class="td-action">
25 <td class="td-action">
24 ${h.secure_form(h.route_path('edit_user_ssh_keys_delete', user_id=c.user.user_id), request=request)}
26 ${h.secure_form(h.route_path('edit_user_ssh_keys_delete', user_id=c.user.user_id), request=request)}
General Comments 0
You need to be logged in to leave comments. Login now