Revision e809b989

b/docs/source/devguide.rst
27 27
=========================  ================================
28 28
Revision                   Description
29 29
=========================  ================================
30
0.8 (Jan 24, 2012)         Update allowed versioning values.
30
0.8 (Feb 9, 2012)          Update allowed versioning values.
31 31
\                          Change policy/meta formatting in JSON/XML replies.
32 32
\                          Document that all non-ASCII characters in headers should be URL-encoded.
33 33
\                          Support metadata-based queries when listing objects at the container level.
......
37 37
\                          Note that ``/login`` will only work if an external authentication system is defined.
38 38
\                          Include option to ignore Content-Type on ``COPY``/``MOVE``.
39 39
\                          Use format parameter for conflict (409) and uploaded hash list (container level) replies.
40
\                          Change permissions model.
40 41
0.7 (Nov 21, 2011)         Suggest upload/download methods using hashmaps.
41 42
\                          Propose syncing algorithm.
42 43
\                          Support cross-account object copy and move.
......
863 864
Return Code                     Description
864 865
==============================  ==============================
865 866
201 (Created)                   The object has been created
866
409 (Conflict)                  The object can not be created from the provided hashmap, or there are conflicting permissions (a list of missing hashes, or a list of conflicting sharing paths will be included in the reply)
867
409 (Conflict)                  The object can not be created from the provided hashmap (a list of missing hashes will be included in the reply)
867 868
411 (Length Required)           Missing ``Content-Length`` or ``Content-Type`` in the request
868 869
413 (Request Entity Too Large)  Insufficient quota to complete the request
869 870
422 (Unprocessable Entity)      The MD5 checksum of the data written to the storage system does not match the (optionally) supplied ETag value
......
913 914
Return Code                     Description
914 915
==============================  ==============================
915 916
201 (Created)                   The object has been created
916
409 (Conflict)                  There are conflicting permissions (a list of conflicting sharing paths will be included in the reply)
917 917
413 (Request Entity Too Large)  Insufficient quota to complete the request
918 918
==============================  ==============================
919 919

  
......
991 991
==============================  ==============================
992 992
202 (Accepted)                  The request has been accepted (not a data update)
993 993
204 (No Content)                The request succeeded (data updated)
994
409 (Conflict)                  There are conflicting permissions (a list of conflicting sharing paths will be included in the reply)
995 994
411 (Length Required)           Missing ``Content-Length`` in the request
996 995
413 (Request Entity Too Large)  Insufficient quota to complete the request
997 996
416 (Range Not Satisfiable)     The supplied range is invalid
......
1045 1044
Sharing and Public Objects
1046 1045
^^^^^^^^^^^^^^^^^^^^^^^^^^
1047 1046

  
1048
Read and write control in Pithos is managed by setting appropriate permissions with the ``X-Object-Sharing`` header. The permissions are applied using prefix-based inheritance. Thus, each set of authorization directives is applied to all objects sharing the same prefix with the object where the corresponding ``X-Object-Sharing`` header is defined. For simplicity, nested/overlapping permissions are not allowed. Setting ``X-Object-Sharing`` will fail, if the object is already "covered", or another object with a longer common-prefix name already has permissions. When retrieving an object, the ``X-Object-Shared-By`` header reports where it gets its permissions from. If not present, the object is the actual source of authorization directives.
1047
Read and write control in Pithos is managed by setting appropriate permissions with the ``X-Object-Sharing`` header. The permissions are applied using directory-based inheritance. A directory is an object with the corresponding content type. The default delimiter is ``/``. Thus, each set of authorization directives is applied to all objects in the directory object where the corresponding ``X-Object-Sharing`` header is defined. If there are nested/overlapping permissions, the closest to the object is applied. When retrieving an object, the ``X-Object-Shared-By`` header reports where it gets its permissions from. If not present, the object is the actual source of authorization directives.
1049 1048

  
1050 1049
A user may ``GET`` another account or container. The result will include a limited reply, containing only the allowed containers or objects respectively. A top-level request with an authentication token, will return a list of allowed accounts, so the user can easily find out which other users share objects. The ``X-Object-Allowed-To`` header lists the actions allowed on an object, if it does not belong to the requesting user.
1051 1050

  
b/pithos/api/functions.py
864 864
        raise ItemNotFound('Container does not exist')
865 865
    except ValueError:
866 866
        raise BadRequest('Invalid sharing header')
867
    except AttributeError, e:
868
        raise Conflict(simple_list_response(request, e.data))
869 867
    except QuotaError:
870 868
        raise RequestEntityTooLarge('Quota exceeded')
871 869
    if 'ETag' not in meta:
......
1050 1048
                raise ItemNotFound('Object does not exist')
1051 1049
            except ValueError:
1052 1050
                raise BadRequest('Invalid sharing header')
1053
            except AttributeError, e:
1054
                raise Conflict(simple_list_response(request, e.data))
1055 1051
        if public is not None:
1056 1052
            try:
1057 1053
                request.backend.update_object_public(request.user_uniq, v_account,
......
1196 1192
        raise ItemNotFound('Container does not exist')
1197 1193
    except ValueError:
1198 1194
        raise BadRequest('Invalid sharing header')
1199
    except AttributeError, e:
1200
        raise Conflict(simple_list_response(request, e.data))
1201 1195
    except QuotaError:
1202 1196
        raise RequestEntityTooLarge('Quota exceeded')
1203 1197
    if public is not None:
b/pithos/api/util.py
326 326
        raise ItemNotFound('Container or object does not exist')
327 327
    except ValueError:
328 328
        raise BadRequest('Invalid sharing header')
329
    except AttributeError, e:
330
        raise Conflict(simple_list_response(request, e.data))
331 329
    except QuotaError:
332 330
        raise RequestEntityTooLarge('Quota exceeded')
333 331
    if public is not None:
b/pithos/backends/base.py
395 395
            NameError: Container/object does not exist
396 396
            
397 397
            ValueError: Invalid users/groups in permissions
398
            
399
            AttributeError: Can not set permissions, as this object
400
                is already shared/private by another object higher
401
                in the hierarchy, or setting permissions here will
402
                invalidate other permissions deeper in the hierarchy
403 398
        """
404 399
        return
405 400
    
......
457 452
            
458 453
            ValueError: Invalid users/groups in permissions
459 454
            
460
            AttributeError: Can not set permissions
461
            
462 455
            QuotaError: Account or container quota exceeded
463 456
        """
464 457
        return ''
......
486 479
            
487 480
            ValueError: Invalid users/groups in permissions
488 481
            
489
            AttributeError: Can not set permissions
490
            
491 482
            QuotaError: Account or container quota exceeded
492 483
        """
493 484
        return ''
......
511 502
            
512 503
            ValueError: Invalid users/groups in permissions
513 504
            
514
            AttributeError: Can not set permissions
515
            
516 505
            QuotaError: Account or container quota exceeded
517 506
        """
518 507
        return ''
b/pithos/backends/modular.py
923 923
    def _check_permissions(self, path, permissions):
924 924
        # raise ValueError('Bad characters in permissions')
925 925
        pass
926
        
927
        # Check for existing permissions.
928
#         paths = self.permissions.access_list(path)
929
#         if paths:
930
#             ae = AttributeError()
931
#             ae.data = paths
932
#             raise ae
933 926
    
934 927
    def _get_permissions_path(self, account, container, name):
935 928
        path = '/'.join((account, container, name))

Also available in: Unified diff