changeset 162:84cfe9fe38c5

Comply with the access model 'open'. Currently, the only implemented access model is 'open', so we should not check for the subscription of the requestor for item retrieval. We do reject outcasts.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 06 Sep 2006 12:57:53 +0000
parents d0dfc01f7638
children 1701c0e2c707
files NEWS idavoll/generic_backend.py
diffstat 2 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Sep 06 12:43:10 2006 +0000
+++ b/NEWS	Wed Sep 06 12:57:53 2006 +0000
@@ -4,6 +4,7 @@
  - Bring errors up to date with version 1.8 of JEP-0060.
  - Add new retrieve-default feature for retrieval of default node
    configuration.
+ - Fully comply with access model 'open'. 
 
 0.5.0 (2006-08-17)
 ==================
--- a/idavoll/generic_backend.py	Wed Sep 06 12:43:10 2006 +0000
+++ b/idavoll/generic_backend.py	Wed Sep 06 12:57:53 2006 +0000
@@ -265,20 +265,15 @@
 
     def get_items(self, node_id, requestor, max_items=None, item_ids=[]):
         d = self.parent.storage.get_node(node_id)
-        d.addCallback(self._is_subscribed, requestor)
+        d.addCallback(_get_affiliation, requestor)
         d.addCallback(self._do_get_items, max_items, item_ids)
         return d
 
-    def _is_subscribed(self, node, subscriber):
-        d = node.is_subscribed(subscriber)
-        d.addCallback(lambda subscribed: (node, subscribed))
-        return d
+    def _do_get_items(self, result, max_items, item_ids):
+        node, affiliation = result
 
-    def _do_get_items(self, result, max_items, item_ids):
-        node, subscribed = result
-
-        if not subscribed:
-            raise backend.NotSubscribed
+        if affiliation == 'outcast':
+            raise backend.Forbidden
 
         if item_ids:
             return node.get_items_by_id(item_ids)