[components] Bookmarks and Admin tools are only avalaible for users and managers
authorVincent Michel <vincent.michel@logilab.fr>
Tue, 16 Jul 2013 16:15:17 +0200
changeset 302 8cd93f6c084c
parent 301 a68ccc6cf620
child 303 5b7153bafd9e
[components] Bookmarks and Admin tools are only avalaible for users and managers
views/actions.py
views/components.py
--- a/views/actions.py	Tue Jul 16 16:09:12 2013 +0200
+++ b/views/actions.py	Tue Jul 16 16:15:17 2013 +0200
@@ -17,7 +17,7 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 
 from cubicweb.web.action import Action
-from cubicweb.predicates import is_instance, nonempty_rset, anonymous_user
+from cubicweb.predicates import is_instance, nonempty_rset, anonymous_user, match_user_groups
 from cubicweb.web.views.actions import (CopyAction, ModifyAction, DeleteAction,
                                         ManagePermissionsAction, AddRelatedActions)
 
@@ -32,7 +32,7 @@
 ###############################################################################
 class BrainomicsAbstractAdminAction(Action):
     __abstract__ = True
-    __select__ = Action.__select__ & nonempty_rset() & ~anonymous_user()
+    __select__ = Action.__select__ & nonempty_rset() & match_user_groups('users', 'managers')
     category = 'action-admin'
     icon = 'question-sign'
     title = None    # action title, i18nable
--- a/views/components.py	Tue Jul 16 16:09:12 2013 +0200
+++ b/views/components.py	Tue Jul 16 16:15:17 2013 +0200
@@ -20,7 +20,8 @@
 
 from cubicweb import tags
 from cubicweb.predicates import (none_rset, one_line_rset, is_instance, nonempty_rset,
-                                 has_related_entities, match_view, anonymous_user)
+                                 has_related_entities, match_view, match_user_groups,
+                                 anonymous_user)
 from cubicweb.web import component
 from cubicweb.web.views.boxes import SearchBox, EditBox
 from cubicweb.web.views.bookmark import BookmarksBox
@@ -223,7 +224,7 @@
 ###############################################################################
 ### REGISTRATION CALLBACK #####################################################
 ###############################################################################
-BookmarksBox.__select__ = BookmarksBox.__select__ & ~anonymous_user()
+BookmarksBox.__select__ = BookmarksBox.__select__ & match_user_groups('users', 'managers')
 ApplicationName.context = 'header-left'