Revision 5e068361 pithos/backends/modular.py

b/pithos/backends/modular.py
401 401
        self.node.node_remove(node)
402 402
        self.queue.send(user, 'diskspace', 0, {'action': 'delete', 'total': 0})
403 403
    
404
    # XXX: Up to here...
405
    
404 406
    @backend_method
405 407
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None):
406 408
        """Return a list of objects existing under a container."""
......
920 922
    
921 923
    def _check_permissions(self, path, permissions):
922 924
        # raise ValueError('Bad characters in permissions')
925
        pass
923 926
        
924 927
        # Check for existing permissions.
925
        paths = self.permissions.access_list(path)
926
        if paths:
927
            ae = AttributeError()
928
            ae.data = paths
929
            raise ae
928
#         paths = self.permissions.access_list(path)
929
#         if paths:
930
#             ae = AttributeError()
931
#             ae.data = paths
932
#             raise ae
933
    
934
    def _get_permissions_path(self, account, container, name):
935
        path = '/'.join((account, container, name))
936
        permission_paths = self.permissions.access_inherit(path)
937
        permission_paths.sort()
938
        permission_paths.reverse()
939
        for p in permission_paths:
940
            if p == path:
941
                return p
942
            else:
943
                try:
944
                    parts = p.split('/', 2)
945
                    if len(parts) != 3:
946
                        return None
947
                    path, node = self._lookup_object(*p.split('/', 2))
948
                    props = self._get_version(node)
949
                    # XXX: Put type in properties...
950
                    meta = dict(self.node.attribute_get(props[self.SERIAL], 'pithos'))
951
                    if meta['Content-Type'] == 'application/directory':
952
                        return p
953
                except NameError:
954
                    pass
955
        return None
930 956
    
931 957
    def _can_read(self, user, account, container, name):
932 958
        if user == account:
933 959
            return True
934
        path = '/'.join((account, container, name))
960
        path = self._get_permissions_path(account, container, name)
935 961
        if not self.permissions.access_check(path, self.READ, user) and not self.permissions.access_check(path, self.WRITE, user):
936 962
            raise NotAllowedError
937 963
    

Also available in: Unified diff