Show More
@@ -32,7 +32,7 b' import shutil' | |||||
32 | from pylons import request, response, tmpl_context as c, url |
|
32 | from pylons import request, response, tmpl_context as c, url | |
33 | from pylons.i18n.translation import _ |
|
33 | from pylons.i18n.translation import _ | |
34 | from pylons.controllers.util import redirect |
|
34 | from pylons.controllers.util import redirect | |
35 | from rhodecode.lib.utils import jsonify |
|
35 | from rhodecode.lib.utils import jsonify, action_logger | |
36 |
|
36 | |||
37 | from rhodecode.lib import diffs |
|
37 | from rhodecode.lib import diffs | |
38 | from rhodecode.lib import helpers as h |
|
38 | from rhodecode.lib import helpers as h | |
@@ -492,7 +492,10 b' class FilesController(BaseRepoController' | |||||
492 | os.remove(archive) |
|
492 | os.remove(archive) | |
493 | break |
|
493 | break | |
494 | yield data |
|
494 | yield data | |
495 |
|
495 | # store download action | ||
|
496 | action_logger(user=c.rhodecode_user, | |||
|
497 | action='user_downloaded_archive:%s' % (archive_name), | |||
|
498 | repo=repo_name, ipaddr=self.ip_addr, commit=True) | |||
496 | response.content_disposition = str('attachment; filename=%s' % (archive_name)) |
|
499 | response.content_disposition = str('attachment; filename=%s' % (archive_name)) | |
497 | response.content_type = str(content_type) |
|
500 | response.content_type = str(content_type) | |
498 | return get_chunked_archive(archive) |
|
501 | return get_chunked_archive(archive) |
@@ -684,6 +684,10 b' def action_parser(user_log, feed=False, ' | |||||
684 | url('pullrequest_show', repo_name=repo_name, |
|
684 | url('pullrequest_show', repo_name=repo_name, | |
685 | pull_request_id=pull_request_id)) |
|
685 | pull_request_id=pull_request_id)) | |
686 |
|
686 | |||
|
687 | def get_archive_name(): | |||
|
688 | archive_name = action_params | |||
|
689 | return archive_name | |||
|
690 | ||||
687 | # action : translated str, callback(extractor), icon |
|
691 | # action : translated str, callback(extractor), icon | |
688 | action_map = { |
|
692 | action_map = { | |
689 | 'user_deleted_repo': (_('[deleted] repository'), |
|
693 | 'user_deleted_repo': (_('[deleted] repository'), | |
@@ -696,6 +700,8 b' def action_parser(user_log, feed=False, ' | |||||
696 | get_fork_name, 'arrow_divide.png'), |
|
700 | get_fork_name, 'arrow_divide.png'), | |
697 | 'user_updated_repo': (_('[updated] repository'), |
|
701 | 'user_updated_repo': (_('[updated] repository'), | |
698 | None, 'database_edit.png'), |
|
702 | None, 'database_edit.png'), | |
|
703 | 'user_downloaded_archive': (_('[downloaded] archive from repository'), | |||
|
704 | get_archive_name, 'page_white_compressed.png'), | |||
699 | 'admin_deleted_repo': (_('[delete] repository'), |
|
705 | 'admin_deleted_repo': (_('[delete] repository'), | |
700 | None, 'database_delete.png'), |
|
706 | None, 'database_delete.png'), | |
701 | 'admin_created_repo': (_('[created] repository'), |
|
707 | 'admin_created_repo': (_('[created] repository'), |
@@ -613,6 +613,11 b' class UserLog(Base, BaseModel):' | |||||
613 | action = Column("action", UnicodeText(1200000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
613 | action = Column("action", UnicodeText(1200000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
614 | action_date = Column("action_date", DateTime(timezone=False), nullable=True, unique=None, default=None) |
|
614 | action_date = Column("action_date", DateTime(timezone=False), nullable=True, unique=None, default=None) | |
615 |
|
615 | |||
|
616 | def __unicode__(self): | |||
|
617 | return u"<%s('id:%s:%s')>" % (self.__class__.__name__, | |||
|
618 | self.repository_name, | |||
|
619 | self.action) | |||
|
620 | ||||
616 | @property |
|
621 | @property | |
617 | def action_as_day(self): |
|
622 | def action_as_day(self): | |
618 | return datetime.date(*self.action_date.timetuple()[:3]) |
|
623 | return datetime.date(*self.action_date.timetuple()[:3]) |
General Comments 0
You need to be logged in to leave comments.
Login now