Closed noyainrain closed 3 years ago
Draft:
_O = TypeVar('_O', bound=Object)
class Owners(Collection[User]):
""":ref:`Collection` of :ref:`Users` s who own the object.
The object has at least one owner.
Events:
.. describe:: object-owners-grant
Published when ownership of the object has been granted to a :ref:`User`.
.. describe:: object-owners-revoke
Published when ownership of the object has been revoked from a :ref:`User`.
"""
def grant(self, user: User) -> None:
"""
.. http:post:: /api/(resource-url)
``{user_id}``
Grant ownership of the object to the :ref:`User` with *user_id*.
Permissions: Object owners.
"""
def revoke(self, user: User) -> None:
"""
.. http:delete:: /api/(resource-url)/(id)
Revoke ownership of the object from the :ref:`User` with *id*.
Permissions: Object owners.
"""
class List:
"""
.. describe:: owners
List :ref:`ListOwners`.
"""
owners: Owners
class CollectionEvent(Generic[_O], Event):
""":ref:`Event` related to a :ref:`Collection`.
.. describe:: item_id
ID of the involved item.
.. describe:: item
Involved item.
"""
item_id: str
item: _O
Make it possible to grant multiple users ownership of a list.