[server/session] Implement anonymous_session
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 17 Jun 2013 17:27:08 +0200
changeset 9048 8481fc6aa6dd
parent 9047 c873445fe198
child 9049 9d62d53b49df
[server/session] Implement anonymous_session Now we have a simple rule to compute if a session is anonymous we can implement the property for server session too. Having it on server side session will helps the rework of the API to access repository. The new schema drop the concept of DBAPISession and use server side session for the same purpose. Related to #2953943 Related to #2503918
server/session.py
--- a/server/session.py	Fri Jun 21 16:07:45 2013 +0200
+++ b/server/session.py	Mon Jun 17 17:27:08 2013 +0200
@@ -1416,6 +1416,13 @@
 
     # deprecated ###############################################################
 
+    @property
+    def anonymous_session(self):
+        # XXX for now, anonymous-user is a web side option.
+        # It will only be present inside all-in-one instance.
+        # there is plan to move it down to global config.
+        return self.user.login == self.repo.config.get('anonymous-user')
+
     @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)')
     def schema_rproperty(self, rtype, eidfrom, eidto, rprop):
         return getattr(self.rtype_eids_rdef(rtype, eidfrom, eidto), rprop)