diff sat_pubsub/error.py @ 349:20b82fb8de02

backend: check nodes/items permission on disco#items: - move node access check workflow from getItemsData to a new checkNodeAccess method - only accessible items are returned to an entity when doing a disco#items on a node - for PEP, nodes with presence access model are not returned if entity has not presence subscription from the node owner - all nodes are returned in normal pubsub service - new NotLeafNodeError exception when an action need to be done on Leaf node and it is not the case - /!\ access it not fully checked : items access models are not handled for items id in disco#items, and whitelist nodes are returned regardless if requestor is in the white list or not. Furthermore, publisher-roster access is not handled for nodes.
author Goffi <goffi@goffi.org>
date Sun, 27 Aug 2017 20:33:39 +0200
parents 5d7c3787672e
children 9fbb31ce495b
line wrap: on
line diff
--- a/sat_pubsub/error.py	Sun Aug 27 20:26:38 2017 +0200
+++ b/sat_pubsub/error.py	Sun Aug 27 20:33:39 2017 +0200
@@ -61,6 +61,7 @@
     def __str__(self):
         return self.msg
 
+
 class Deprecated(Exception):
     pass
 
@@ -69,93 +70,79 @@
     pass
 
 
-
 class NodeExists(Error):
     pass
 
 
-
 class NotSubscribed(Error):
     """
     Entity is not subscribed to this node.
     """
 
 
-
 class SubscriptionExists(Error):
     """
     There already exists a subscription to this node.
     """
 
 
+def NotLeafNodeError(Error):
+    """a leaf node is expected but we have a collection"""
+
 
 class Forbidden(Error):
     pass
 
 
-
 class NotAuthorized(Error):
     pass
 
 
-
 class NotInRoster(Error):
     pass
 
 
-
 class ItemNotFound(Error):
     pass
 
 
-
 class ItemForbidden(Error):
     pass
 
 
-
 class ItemRequired(Error):
     pass
 
 
-
 class NoInstantNodes(Error):
     pass
 
 
-
 class InvalidConfigurationOption(Error):
     msg = 'Invalid configuration option'
 
 
-
 class InvalidConfigurationValue(Error):
     msg = 'Bad configuration value'
 
 
-
 class NodeNotPersistent(Error):
     pass
 
 
-
 class NoRootNode(Error):
     pass
 
 
-
 class NoCallbacks(Error):
     """
     There are no callbacks for this node.
     """
 
-
-
 class NoCollections(Error):
     pass
 
 
-
 class NoPublishing(Error):
     """
     This node does not support publishing.