Revision 15a96c3e pithos/backends/modular.py

b/pithos/backends/modular.py
423 423
        self._report_size_change(user, account, -size, {'action': 'container delete'})
424 424
    
425 425
    def _list_objects(self, user, account, container, prefix, delimiter, marker, limit, virtual, domain, keys, shared, until, size_range, all_props):
426
        if user != account and until:
427
            raise NotAllowedError
428
        allowed = self._list_object_permissions(user, account, container, prefix, shared)
429
        path, node = self._lookup_container(account, container)
430
        allowed = self._get_formatted_paths(allowed)
431
        return self._list_object_properties(node, path, prefix, delimiter, marker, limit, virtual, domain, keys, until, size_range, allowed, all_props)
432
    
433
    def _list_object_permissions(self, user, account, container, prefix, shared):
426 434
        allowed = []
427 435
        if user != account:
428
            if until:
429
                raise NotAllowedError
430
            allowed = self.permissions.access_list_paths(user, '/'.join((account, container)))
436
            allowed = self.permissions.access_list_paths(user, '/'.join((account, container, prefix)))
431 437
            if not allowed:
432 438
                raise NotAllowedError
433 439
        else:
434 440
            if shared:
435
                allowed = self.permissions.access_list_shared('/'.join((account, container)))
441
                allowed = self.permissions.access_list_shared('/'.join((account, container, prefix)))
436 442
                if not allowed:
437 443
                    return []
438
        path, node = self._lookup_container(account, container)
439
        allowed = self._get_formatted_paths(allowed)
440
        return self._list_object_properties(node, path, prefix, delimiter, marker, limit, virtual, domain, keys, until, size_range, allowed, all_props)
444
        return allowed
441 445
    
442 446
    @backend_method
443 447
    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):
......
470 474
        return objects
471 475
    
472 476
    @backend_method
477
    def list_object_permissions(self, user, account, container, prefix=''):
478
        """Return a list of paths that enforce permissions under a container."""
479
        
480
        logger.debug("list_object_permissions: %s %s %s", account, container, prefix)
481
        return self._list_object_permissions(user, account, container, prefix, True)
482
    
483
    @backend_method
484
    def list_object_public(self, user, account, container, prefix=''):
485
        """Return a dict mapping paths to public ids for objects that are public under a container."""
486
        
487
        logger.debug("list_object_public: %s %s %s", account, container, prefix)
488
        public = {}
489
        for path, p in self.permissions.public_list('/'.join((account, container, prefix))):
490
            public[path] = p + ULTIMATE_ANSWER
491
        return public
492
    
493
    @backend_method
473 494
    def get_object_meta(self, user, account, container, name, domain, version=None):
474 495
        """Return a dictionary with the object metadata for the domain."""
475 496
        

Also available in: Unified diff