##// END OF EJS Templates
store download archive actions in journal
marcink -
r3868:e262494c beta
parent child Browse files
Show More
@@ -32,7 +32,7 b' import shutil'
32 32 from pylons import request, response, tmpl_context as c, url
33 33 from pylons.i18n.translation import _
34 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 37 from rhodecode.lib import diffs
38 38 from rhodecode.lib import helpers as h
@@ -492,7 +492,10 b' class FilesController(BaseRepoController'
492 492 os.remove(archive)
493 493 break
494 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 499 response.content_disposition = str('attachment; filename=%s' % (archive_name))
497 500 response.content_type = str(content_type)
498 501 return get_chunked_archive(archive)
@@ -684,6 +684,10 b' def action_parser(user_log, feed=False, '
684 684 url('pullrequest_show', repo_name=repo_name,
685 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 691 # action : translated str, callback(extractor), icon
688 692 action_map = {
689 693 'user_deleted_repo': (_('[deleted] repository'),
@@ -696,6 +700,8 b' def action_parser(user_log, feed=False, '
696 700 get_fork_name, 'arrow_divide.png'),
697 701 'user_updated_repo': (_('[updated] repository'),
698 702 None, 'database_edit.png'),
703 'user_downloaded_archive': (_('[downloaded] archive from repository'),
704 get_archive_name, 'page_white_compressed.png'),
699 705 'admin_deleted_repo': (_('[delete] repository'),
700 706 None, 'database_delete.png'),
701 707 'admin_created_repo': (_('[created] repository'),
@@ -613,6 +613,11 b' class UserLog(Base, BaseModel):'
613 613 action = Column("action", UnicodeText(1200000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
614 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 621 @property
617 622 def action_as_day(self):
618 623 return datetime.date(*self.action_date.timetuple()[:3])
General Comments 0
You need to be logged in to leave comments. Login now