ssh: improve logging, and make the UI show last accessed date for key.
This commit is contained in:
parent
8a80d9dc4d
commit
a55becaad1
4 changed files with 15 additions and 5 deletions
|
|
@ -62,7 +62,8 @@ class SshWrapper(object):
|
|||
key.accessed_on = datetime.datetime.utcnow()
|
||||
Session().add(key)
|
||||
Session().commit()
|
||||
log.debug('Update key `%s` access time', key_id)
|
||||
log.debug('Update key id:`%s` fingerprint:`%s` access time',
|
||||
key_id, key.ssh_key_fingerprint)
|
||||
|
||||
def get_connection_info(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ class VcsServer(object):
|
|||
'permission for %s on %s are: %s',
|
||||
self.user, self.repo_name, permission)
|
||||
|
||||
if not permission:
|
||||
log.error('user `%s` permissions to repo:%s are empty. Forbidding access.',
|
||||
self.user, self.repo_name)
|
||||
return -2
|
||||
|
||||
if action == 'pull':
|
||||
if permission in self.read_perms:
|
||||
log.info(
|
||||
|
|
@ -83,8 +88,8 @@ class VcsServer(object):
|
|||
self.user, self.repo_name)
|
||||
return 0
|
||||
|
||||
log.error('Cannot properly fetch or allow user %s permissions. '
|
||||
'Return value is: %s, req action: %s',
|
||||
log.error('Cannot properly fetch or verify user `%s` permissions. '
|
||||
'Permissions: %s, vcs action: %s',
|
||||
self.user, permission, action)
|
||||
return -2
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
<tr>
|
||||
<th>${_('Fingerprint')}</th>
|
||||
<th>${_('Description')}</th>
|
||||
<th>${_('Created')}</th>
|
||||
<th>${_('Created on')}</th>
|
||||
<th>${_('Accessed on')}</th>
|
||||
<th>${_('Action')}</th>
|
||||
</tr>
|
||||
% if not c.ssh_enabled:
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
</td>
|
||||
<td class="td-wrap">${ssh_key.description}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.accessed_on)}</td>
|
||||
|
||||
<td class="td-action">
|
||||
${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
<tr>
|
||||
<th>${_('Fingerprint')}</th>
|
||||
<th>${_('Description')}</th>
|
||||
<th>${_('Created')}</th>
|
||||
<th>${_('Created on')}</th>
|
||||
<th>${_('Accessed on')}</th>
|
||||
<th>${_('Action')}</th>
|
||||
</tr>
|
||||
%if c.user_ssh_keys:
|
||||
|
|
@ -19,6 +20,7 @@
|
|||
</td>
|
||||
<td class="td-wrap">${ssh_key.description}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
|
||||
<td class="td-tags">${h.format_date(ssh_key.accessed_on)}</td>
|
||||
|
||||
<td class="td-action">
|
||||
${h.secure_form(h.route_path('edit_user_ssh_keys_delete', user_id=c.user.user_id), request=request)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue