comparison pylons_app/controllers/files.py @ 331:fdf9f6ee5217

Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 29 Jun 2010 20:45:03 +0200
parents 2d61aa00e855
children 588c6147efc7
comparison
equal deleted inserted replaced
330:c961b78ff0a0 331:fdf9f6ee5217
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # encoding: utf-8 2 # encoding: utf-8
3 # files controller for pylons 3 # files controller for pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 from mercurial import archival 5
6 from pylons import request, response, session, tmpl_context as c, url
7 from pylons.controllers.util import redirect
8 from pylons_app.lib.auth import LoginRequired
9 from pylons_app.lib.base import BaseController, render
10 from pylons_app.lib.utils import EmptyChangeset
11 from pylons_app.model.hg_model import HgModel
12 from vcs.exceptions import RepositoryError, ChangesetError
13 from vcs.nodes import FileNode
14 from vcs.utils import diffs as differ
15 import logging
16 import pylons_app.lib.helpers as h
17 import tempfile
18
19 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
21 # as published by the Free Software Foundation; version 2 8 # as published by the Free Software Foundation; version 2
22 # of the License or (at your opinion) any later version of the license. 9 # of the License or (at your opinion) any later version of the license.
23 # 10 #
33 """ 20 """
34 Created on April 21, 2010 21 Created on April 21, 2010
35 files controller for pylons 22 files controller for pylons
36 @author: marcink 23 @author: marcink
37 """ 24 """
38 25 from mercurial import archival
26 from pylons import request, response, session, tmpl_context as c, url
27 from pylons.controllers.util import redirect
28 from pylons_app.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
29 from pylons_app.lib.base import BaseController, render
30 from pylons_app.lib.utils import EmptyChangeset, get_repo_slug
31 from pylons_app.model.hg_model import HgModel
32 from vcs.exceptions import RepositoryError, ChangesetError
33 from vcs.nodes import FileNode
34 from vcs.utils import diffs as differ
35 import logging
36 import pylons_app.lib.helpers as h
37 import tempfile
39 38
40 log = logging.getLogger(__name__) 39 log = logging.getLogger(__name__)
41 40
42 class FilesController(BaseController): 41 class FilesController(BaseController):
43 42
44 @LoginRequired() 43 @LoginRequired()
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
45 'repository.admin')
45 def __before__(self): 46 def __before__(self):
46 super(FilesController, self).__before__() 47 super(FilesController, self).__before__()
47 48
48 def index(self, repo_name, revision, f_path): 49 def index(self, repo_name, revision, f_path):
49 hg_model = HgModel() 50 hg_model = HgModel()