Remove error for overlapping permissions. Document.
authorAntony Chazapis <chazapis@gmail.com>
Thu, 9 Feb 2012 10:02:21 +0000 (12:02 +0200)
committerAntony Chazapis <chazapis@gmail.com>
Thu, 9 Feb 2012 10:02:21 +0000 (12:02 +0200)
docs/source/devguide.rst
pithos/api/functions.py
pithos/api/util.py
pithos/backends/base.py
pithos/backends/modular.py

index 0e00b23..62d467e 100644 (file)
@@ -27,7 +27,7 @@ Document Revisions
 =========================  ================================
 Revision                   Description
 =========================  ================================
-0.8 (Jan 24, 2012)         Update allowed versioning values.
+0.8 (Feb 9, 2012)          Update allowed versioning values.
 \                          Change policy/meta formatting in JSON/XML replies.
 \                          Document that all non-ASCII characters in headers should be URL-encoded.
 \                          Support metadata-based queries when listing objects at the container level.
@@ -37,6 +37,7 @@ Revision                   Description
 \                          Note that ``/login`` will only work if an external authentication system is defined.
 \                          Include option to ignore Content-Type on ``COPY``/``MOVE``.
 \                          Use format parameter for conflict (409) and uploaded hash list (container level) replies.
+\                          Change permissions model.
 0.7 (Nov 21, 2011)         Suggest upload/download methods using hashmaps.
 \                          Propose syncing algorithm.
 \                          Support cross-account object copy and move.
@@ -863,7 +864,7 @@ The ``X-Object-Sharing`` header may include either a ``read=...`` comma-separate
 Return Code                     Description
 ==============================  ==============================
 201 (Created)                   The object has been created
-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)
+409 (Conflict)                  The object can not be created from the provided hashmap (a list of missing hashes will be included in the reply)
 411 (Length Required)           Missing ``Content-Length`` or ``Content-Type`` in the request
 413 (Request Entity Too Large)  Insufficient quota to complete the request
 422 (Unprocessable Entity)      The MD5 checksum of the data written to the storage system does not match the (optionally) supplied ETag value
@@ -913,7 +914,6 @@ X-Object-Version            The object's new version
 Return Code                     Description
 ==============================  ==============================
 201 (Created)                   The object has been created
-409 (Conflict)                  There are conflicting permissions (a list of conflicting sharing paths will be included in the reply)
 413 (Request Entity Too Large)  Insufficient quota to complete the request
 ==============================  ==============================
 
@@ -991,7 +991,6 @@ Return Code                     Description
 ==============================  ==============================
 202 (Accepted)                  The request has been accepted (not a data update)
 204 (No Content)                The request succeeded (data updated)
-409 (Conflict)                  There are conflicting permissions (a list of conflicting sharing paths will be included in the reply)
 411 (Length Required)           Missing ``Content-Length`` in the request
 413 (Request Entity Too Large)  Insufficient quota to complete the request
 416 (Range Not Satisfiable)     The supplied range is invalid
@@ -1045,7 +1044,7 @@ Return Code                  Description
 Sharing and Public Objects
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-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.
+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.
 
 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.
 
index 77a5abd..3a3baf4 100644 (file)
@@ -864,8 +864,6 @@ def object_write(request, v_account, v_container, v_object):
         raise ItemNotFound('Container does not exist')
     except ValueError:
         raise BadRequest('Invalid sharing header')
-    except AttributeError, e:
-        raise Conflict(simple_list_response(request, e.data))
     except QuotaError:
         raise RequestEntityTooLarge('Quota exceeded')
     if 'ETag' not in meta:
@@ -1050,8 +1048,6 @@ def object_update(request, v_account, v_container, v_object):
                 raise ItemNotFound('Object does not exist')
             except ValueError:
                 raise BadRequest('Invalid sharing header')
-            except AttributeError, e:
-                raise Conflict(simple_list_response(request, e.data))
         if public is not None:
             try:
                 request.backend.update_object_public(request.user_uniq, v_account,
@@ -1196,8 +1192,6 @@ def object_update(request, v_account, v_container, v_object):
         raise ItemNotFound('Container does not exist')
     except ValueError:
         raise BadRequest('Invalid sharing header')
-    except AttributeError, e:
-        raise Conflict(simple_list_response(request, e.data))
     except QuotaError:
         raise RequestEntityTooLarge('Quota exceeded')
     if public is not None:
index c8f310d..4957e7a 100644 (file)
@@ -326,8 +326,6 @@ def copy_or_move_object(request, src_account, src_container, src_name, dest_acco
         raise ItemNotFound('Container or object does not exist')
     except ValueError:
         raise BadRequest('Invalid sharing header')
-    except AttributeError, e:
-        raise Conflict(simple_list_response(request, e.data))
     except QuotaError:
         raise RequestEntityTooLarge('Quota exceeded')
     if public is not None:
index daf789d..49b3d37 100644 (file)
@@ -395,11 +395,6 @@ class BaseBackend(object):
             NameError: Container/object does not exist
             
             ValueError: Invalid users/groups in permissions
-            
-            AttributeError: Can not set permissions, as this object
-                is already shared/private by another object higher
-                in the hierarchy, or setting permissions here will
-                invalidate other permissions deeper in the hierarchy
         """
         return
     
@@ -457,8 +452,6 @@ class BaseBackend(object):
             
             ValueError: Invalid users/groups in permissions
             
-            AttributeError: Can not set permissions
-            
             QuotaError: Account or container quota exceeded
         """
         return ''
@@ -486,8 +479,6 @@ class BaseBackend(object):
             
             ValueError: Invalid users/groups in permissions
             
-            AttributeError: Can not set permissions
-            
             QuotaError: Account or container quota exceeded
         """
         return ''
@@ -511,8 +502,6 @@ class BaseBackend(object):
             
             ValueError: Invalid users/groups in permissions
             
-            AttributeError: Can not set permissions
-            
             QuotaError: Account or container quota exceeded
         """
         return ''
index ce67f28..5daa884 100644 (file)
@@ -923,13 +923,6 @@ class ModularBackend(BaseBackend):
     def _check_permissions(self, path, permissions):
         # raise ValueError('Bad characters in permissions')
         pass
-        
-        # Check for existing permissions.
-#         paths = self.permissions.access_list(path)
-#         if paths:
-#             ae = AttributeError()
-#             ae.data = paths
-#             raise ae
     
     def _get_permissions_path(self, account, container, name):
         path = '/'.join((account, container, name))