[Mpuls-commits] r2536 - wasko/branches/2.0/jmdweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Apr 28 12:50:37 CEST 2010
Author: torsten
Date: 2010-04-28 12:50:36 +0200 (Wed, 28 Apr 2010)
New Revision: 2536
Modified:
wasko/branches/2.0/jmdweb/controllers/jmdstruktur.py
Log:
jmdweb/controllers/jmdstruktur.py
(JmdstrukturController.permissionAction): Added methods to set
users who are permitted to access to jmdstruktur-modul
Modified: wasko/branches/2.0/jmdweb/controllers/jmdstruktur.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/jmdstruktur.py 2010-04-27 14:59:10 UTC (rev 2535)
+++ wasko/branches/2.0/jmdweb/controllers/jmdstruktur.py 2010-04-28 10:50:36 UTC (rev 2536)
@@ -33,20 +33,48 @@
import formencode
-from mpulsweb.lib.base import BaseController, c, g, render, request, session
+from mpulsweb.model.user import UserListObject
+from mpulsweb.model.agencysettings import Agency
+from mpulsweb.lib.base import BaseController, c, g, render, request, session, h
from mpulsweb.lib.security import checkRole
+from jmdweb.lib.validators import PermissionForm
+
log = logging.getLogger(__name__)
class JmdstrukturController(BaseController):
- @checkRole('cm_ka')
+ @checkRole(['cm', 'admin'])
def index(self):
page = render('jmdstruktur/overview.mako')
return formencode.htmlfill.render(page,
defaults={},
errors={})
- @checkRole('cm_ka')
+
+ @checkRole('admin')
+ def permission(self):
+ agency = Agency()
+ permission = agency.get_value('jmdstrukur_permission_userid', []).split(',')
+ c.userlist = UserListObject().getUserList()
+ userlist = UserListObject().getUserList()
+ defaults = {'userid': permission}
+ page = render('jmdstruktur/permission.mako')
+ return formencode.htmlfill.render(page,
+ defaults=defaults,
+ errors={})
+
+ @checkRole('admin')
+ def permissionAction(self):
+ agency = Agency()
+ validator = PermissionForm()
+ c.userlist = UserListObject().getUserList()
+ form_resut = validator.to_python(request.params)
+ agency.store({'jmdstrukur_permission_userid': ",".join(form_resut['userid'])})
+ c.status_msg = h.status_message("Berechtigung erfolgreich gesetzt.")
+ page = render('jmdstruktur/permission.mako')
+ return self.permission()
+
+ @checkRole(['cm', 'admin'])
def new(self):
page = render('jmdstruktur/new.mako')
return formencode.htmlfill.render(page,
More information about the Mpuls-commits
mailing list