Mercurial > kallithea
diff rhodecode/controllers/admin/permissions.py @ 1512:bf263968da47
merge beta in stable branch
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 07 Oct 2011 01:08:50 +0200 |
parents | a3b2b4b4e440 a828b83dfa4b |
children | 752b0a7b7679 |
line wrap: on
line diff
--- a/rhodecode/controllers/admin/permissions.py Thu May 12 19:50:48 2011 +0200 +++ b/rhodecode/controllers/admin/permissions.py Fri Oct 07 01:08:50 2011 +0200 @@ -2,12 +2,12 @@ """ rhodecode.controllers.admin.permissions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + permissions controller for Rhodecode - + :created_on: Apr 27, 2010 :author: marcink - :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> + :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> :license: GPLv3, see COPYING for more details. """ # This program is free software: you can redistribute it and/or modify @@ -23,24 +23,25 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import logging +import traceback +import formencode from formencode import htmlfill + from pylons import request, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect from pylons.i18n.translation import _ + from rhodecode.lib import helpers as h from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator -from rhodecode.lib.auth_ldap import LdapImportError from rhodecode.lib.base import BaseController, render -from rhodecode.model.forms import LdapSettingsForm, DefaultPermissionsForm +from rhodecode.model.forms import DefaultPermissionsForm from rhodecode.model.permission import PermissionModel -from rhodecode.model.settings import SettingsModel -from rhodecode.model.user import UserModel -import formencode -import logging -import traceback +from rhodecode.model.db import User log = logging.getLogger(__name__) + class PermissionsController(BaseController): """REST Controller styled on the Atom Publishing Protocol""" # To properly map this controller, ensure your config/routing.py @@ -69,7 +70,6 @@ self.create_choices = [('hg.create.none', _('Disabled')), ('hg.create.repository', _('Enabled'))] - def index(self, format='html'): """GET /permissions: All items in the collection""" # url('permissions') @@ -99,7 +99,7 @@ try: form_result = _form.to_python(dict(request.POST)) - form_result.update({'perm_user_name':id}) + form_result.update({'perm_user_name': id}) permission_model.update(form_result) h.flash(_('Default permissions updated successfully'), category='success') @@ -123,8 +123,6 @@ return redirect(url('edit_permission', id=id)) - - def delete(self, id): """DELETE /permissions/id: Delete an existing item""" # Forms posted to this method should contain a hidden field: @@ -146,9 +144,9 @@ c.create_choices = self.create_choices if id == 'default': - default_user = UserModel().get_by_username('default') - defaults = {'_method':'put', - 'anonymous':default_user.active} + default_user = User.by_username('default') + defaults = {'_method': 'put', + 'anonymous': default_user.active} for p in default_user.user_perms: if p.permission.permission_name.startswith('repository.'):