Revision 8a0c7040 snf-pithos-app/pithos/api/functions.py
b/snf-pithos-app/pithos/api/functions.py | ||
---|---|---|
646 | 646 |
shared = False |
647 | 647 |
if 'shared' in request.GET: |
648 | 648 |
shared = True |
649 |
public = False |
|
650 |
if request.user_uniq == v_account and 'public' in request.GET:
|
|
651 |
public = True
|
|
649 |
|
|
650 |
public_requested = 'public' in request.GET
|
|
651 |
public_granted = public_requested and request.user_uniq == v_account
|
|
652 | 652 |
|
653 | 653 |
if request.serialization == 'text': |
654 | 654 |
try: |
... | ... | |
656 | 656 |
request.user_uniq, v_account, |
657 | 657 |
v_container, prefix, delimiter, marker, |
658 | 658 |
limit, virtual, 'pithos', keys, shared, |
659 |
until, None, public) |
|
659 |
until, None, public_granted)
|
|
660 | 660 |
except NotAllowedError: |
661 | 661 |
raise Forbidden('Not allowed') |
662 | 662 |
except ItemNotExists: |
... | ... | |
674 | 674 |
objects = request.backend.list_object_meta( |
675 | 675 |
request.user_uniq, v_account, |
676 | 676 |
v_container, prefix, delimiter, marker, |
677 |
limit, virtual, 'pithos', keys, shared, until, None, public) |
|
677 |
limit, virtual, 'pithos', keys, shared, until, None, public_granted)
|
|
678 | 678 |
object_permissions = {} |
679 | 679 |
object_public = {} |
680 | 680 |
if until is None: |
... | ... | |
690 | 690 |
object = x[name_idx:] |
691 | 691 |
object_permissions[object] = request.backend.get_object_permissions( |
692 | 692 |
request.user_uniq, v_account, v_container, object) |
693 |
for k, v in request.backend.list_object_public(request.user_uniq, |
|
694 |
v_account, v_container, prefix).iteritems(): |
|
695 |
object_public[k[name_idx:]] = v |
|
693 |
|
|
694 |
if public_granted: |
|
695 |
for k, v in request.backend.list_object_public( |
|
696 |
request.user_uniq, v_account, |
|
697 |
v_container, prefix).iteritems(): |
|
698 |
object_public[k[name_idx:]] = v |
|
696 | 699 |
except NotAllowedError: |
697 | 700 |
raise Forbidden('Not allowed') |
698 | 701 |
except ItemNotExists: |
... | ... | |
729 | 732 |
if permissions: |
730 | 733 |
update_sharing_meta(request, permissions, v_account, |
731 | 734 |
v_container, meta['name'], meta) |
732 |
public = object_public.get(meta['name'], None) |
|
733 |
if public and request.user_uniq == v_account:
|
|
734 |
update_public_meta(public, meta) |
|
735 |
public_url = object_public.get(meta['name'], None)
|
|
736 |
if public_granted:
|
|
737 |
update_public_meta(public_url, meta)
|
|
735 | 738 |
object_meta.append(printable_header_dict(meta)) |
736 | 739 |
|
737 | 740 |
if request.serialization == 'xml': |
Also available in: Unified diff