Commits

Anonymous committed 52c2c51

hide authenticated user menu for shared users

Comments (0)

Files changed (1)

 
 from uuid import uuid4
 
+from logilab.common.registry import objectify_predicate
+
 from cubicweb import view, tags
 from cubicweb.predicates import relation_possible, match_user_groups, adaptable
 from cubicweb.web import Redirect, component
-from cubicweb.web.views import urlpublishing, uicfg
+from cubicweb.web.views import urlpublishing, uicfg, basecomponents
+
+
+@objectify_predicate
+def is_shared_session(cls, req, *args, **kwargs):
+    if req.session.data.get('shared-url-session'):
+        return 1
+    else:
+        return 0
 
 
 _pvs = uicfg.primaryview_section
         assert not ishare.share_url()
         ishare.share()
         raise Redirect(entity.absolute_url())
+
+
+# authenticated menu shouldn't appear for shared url session
+basecomponents.AuthenticatedUserStatus.__select__ &= ~is_shared_session()