From: Ricardo Markiewicz Date: Tue, 13 Mar 2007 01:38:30 +0000 (+0000) Subject: Atributo especial en Controllers para poder ocultar entradas del menu para Admin. X-Git-Tag: 0_9~18 X-Git-Url: https://git.llucax.com/software/sercom.git/commitdiff_plain/a0674923171dc6dc48da9b5259b3a71f18e92f8b?ds=sidebyside Atributo especial en Controllers para poder ocultar entradas del menu para Admin. Es medio hack elegante :P --- diff --git a/sercom/menu.py b/sercom/menu.py index da714d1..bc9fbee 100644 --- a/sercom/menu.py +++ b/sercom/menu.py @@ -13,6 +13,7 @@ class Menu: self.items = ['dashboard'] + self.items def _check(self, c): + if hasattr(c, 'hide_to_admin') and 'admin' in identity.current.permissions: return False return c.require.eval_with_object(identity.current) def __repr__(self): diff --git a/sercom/subcontrollers/miscorrecciones/__init__.py b/sercom/subcontrollers/miscorrecciones/__init__.py index b097a78..c4404e0 100644 --- a/sercom/subcontrollers/miscorrecciones/__init__.py +++ b/sercom/subcontrollers/miscorrecciones/__init__.py @@ -28,6 +28,8 @@ class MisCorreccionesController(controllers.Controller, identity.SecureResource) """Basic model admin interface""" require = identity.has_permission('entregar') + hide_to_admin = 1 + @expose() def default(self, tg_errors=None): """handle non exist urls""" diff --git a/sercom/subcontrollers/misentregas/__init__.py b/sercom/subcontrollers/misentregas/__init__.py index 8ea647f..57d7b8a 100644 --- a/sercom/subcontrollers/misentregas/__init__.py +++ b/sercom/subcontrollers/misentregas/__init__.py @@ -105,6 +105,8 @@ class MisEntregasController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('entregar') + hide_to_admin = 1 + @expose() def default(self, tg_errors=None): """handle non exist urls"""