comparison rhodecode/controllers/admin/admin.py @ 547:1e757ac98988

renamed project to rhodecode
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 06 Oct 2010 03:18:16 +0200
parents pylons_app/controllers/admin/admin.py@664a5b8c551a
children fb7a3b291e64
comparison
equal deleted inserted replaced
546:7c2f5e4d7bbf 547:1e757ac98988
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # admin controller for pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2
9 # of the License or (at your opinion) any later version of the license.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20 """
21 Created on April 7, 2010
22 admin controller for pylons
23 @author: marcink
24 """
25 import logging
26 from pylons import request, response, session, tmpl_context as c
27 from rhodecode.lib.base import BaseController, render
28 from rhodecode.model import meta
29 from rhodecode.model.db import UserLog
30 from webhelpers.paginate import Page
31 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
32
33 log = logging.getLogger(__name__)
34
35 class AdminController(BaseController):
36
37 @LoginRequired()
38 def __before__(self):
39 super(AdminController, self).__before__()
40
41 @HasPermissionAllDecorator('hg.admin')
42 def index(self):
43
44 users_log = self.sa.query(UserLog).order_by(UserLog.action_date.desc())
45 p = int(request.params.get('page', 1))
46 c.users_log = Page(users_log, page=p, items_per_page=10)
47 c.log_data = render('admin/admin_log.html')
48 if request.params.get('partial'):
49 return c.log_data
50 return render('admin/admin.html')
51