Permission
==========

.. _Permission:

Permission
----------

Access Rights

.. code-block:: json

 message Permission {
  bool read = 2;
  bool write = 3;
  bool delete = 4;
  bool admin = 5;
  DownloadRight download_right = 6;

  bool read_children = 7;
  bool write_children = 8;
  bool delete_children = 9;
 }

+---------------------+-------------------+------------------------------------------+
| Field               | Type              | Description                              |
+=====================+===================+==========================================+
| ``read``            | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``write``           | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``delete``          | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``admin``           | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``download_right``  | ``DownloadRight`` | See :ref:`DownloadRight <DownloadRight>` |
+---------------------+-------------------+------------------------------------------+
| ``read_children``   | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``write_children``  | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+
| ``delete_children`` | ``bool``          |                                          |
+---------------------+-------------------+------------------------------------------+

.. _ItemPermissionsEntry:

ItemPermissionsEntry
--------------------

One entry (group or user) of permissions

.. code-block:: json

 message ItemPermissionsEntry {
  string id = 1;
  string title = 2;
  PermissionType permission = 3;
  PermissionEntryType type = 4;
  optional bool is_equal = 5;
  optional int32 found_in_items = 6;
 }

+--------------------+-------------------------+------------------------------------------------------+
| Field              | Type                    | Description                                          |
+====================+=========================+======================================================+
| ``id``             | ``string``              |                                                      |
+--------------------+-------------------------+------------------------------------------------------+
| ``title``          | ``string``              |                                                      |
+--------------------+-------------------------+------------------------------------------------------+
| ``permission``     | ``PermissionType``      | See :ref:`PermissionType <PermissionType>`           |
+--------------------+-------------------------+------------------------------------------------------+
| ``type``           | ``PermissionEntryType`` | See :ref:`PermissionEntryType <PermissionEntryType>` |
+--------------------+-------------------------+------------------------------------------------------+
| ``is_equal``       | ``bool``                | **Optional**                                         |
+--------------------+-------------------------+------------------------------------------------------+
| ``found_in_items`` | ``int32``               | **Optional**                                         |
+--------------------+-------------------------+------------------------------------------------------+

.. _PermissionSettings:

PermissionSettings
------------------

Additional Settings for permissions set by client

.. code-block:: json

 message PermissionSettings {
  optional bool change_all_groups = 1;
  optional bool recursive = 2;
 }

+-----------------------+----------+----------------+
| Field                 | Type     | Description    |
+=======================+==========+================+
| ``change_all_groups`` | ``bool`` | **Optional**   |
+-----------------------+----------+----------------+
| ``recursive``         | ``bool`` | **Optional**   |
+-----------------------+----------+----------------+

.. _EffectivePermission:

EffectivePermission
-------------------

The item-based effective access right for the current user

.. code-block:: json
 
 message EffectivePermission {
  bool read = 1;
  bool write = 2;
  bool delete = 3;
  bool admin = 4;
  DownloadRight download_right = 5;
  bool read_children = 6;
  bool write_children = 7;
  bool delete_children = 8;
  optional bool read_metadata = 9;
  optional bool shared_write = 10;
  optional bool write_comments = 11;

  optional EffectivePermissionQuestion question_permissions = 12;
  optional EffectivePermissionAnswer answer_permissions = 13;
  optional bool read_comments = 14;
  optional EffectivePermissionComment comment_permissions = 15;
 }

+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| Field                    | Type                            | Description                                                                       |
+==========================+=================================+===================================================================================+
| ``read``                 | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``write``                | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``delete``               | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``admin``                | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``download_right``       | ``DownloadRight``               | See :ref:`DownloadRight <DownloadRight>`                                          |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``read_children``        | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``write_children``       | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``delete_children``      | ``bool``                        |                                                                                   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``read_metadata``        | ``bool``                        | **Optional**                                                                      |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``shared_write``         | ``bool``                        | **Optional**                                                                      |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``write_comments``       | ``bool``                        | **Optional**                                                                      |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``question_permissions`` | ``EffectivePermissionQuestion`` | **Optional** See :ref:`EffectivePermissionQuestion <EffectivePermissionQuestion>` |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``answer_permissions``   | ``EffectivePermissionAnswer``   | **Optional** See :ref:`EffectivePermissionAnswer <EffectivePermissionAnswer>`     |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``read_comments``        | ``bool``                        | **Optional**                                                                      |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+
| ``comment_permissions``  | ``EffectivePermissionComment``  | **Optional** See :ref:`EffectivePermissionComment <EffectivePermissionComment>`   |
+--------------------------+---------------------------------+-----------------------------------------------------------------------------------+

.. _EffectivePermissionQuestion:

EffectivePermissionQuestion
---------------------------

The effective access right for the current user for a Question

.. code-block:: json

 message EffectivePermissionQuestion {
  bool create_question = 1;
  bool delete_question = 2;
  bool change_question_status = 3;
  bool change_question_text = 4;
  bool change_question_priority = 5;
  bool change_question_assignment = 6;
  bool change_question_category = 7;
  bool change_question_attachments = 8;
  bool change_question_deadline = 9;

  // Answer
  bool create_answer = 11;
 }

+---------------------------------+----------+-------------+
| Field                           | Type     | Description |
+=================================+==========+=============+
| ``create_question``             | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``delete_question``             | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_status``      | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_text``        | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_priority``    | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_assignment``  | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_category``    | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_attachments`` | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``change_question_deadline``    | ``bool`` |             |
+---------------------------------+----------+-------------+
| ``create_answer``               | ``bool`` | Answer      |
+---------------------------------+----------+-------------+

.. _EffectivePermissionAnswer:

EffectivePermissionAnswer
-------------------------

The effective access right for the current user for an Answer

.. code-block:: json

 message EffectivePermissionAnswer {
  bool delete_answer = 1;
  bool change_answer_text = 2;
  bool change_answer_state = 3;
  bool change_answer_attachments = 4;
 }

+-------------------------------+----------+-------------+
| Field                         | Type     | Description |
+===============================+==========+=============+
| ``delete_answer``             | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_answer_text``        | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_answer_state``       | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_answer_attachments`` | ``bool`` |             |
+-------------------------------+----------+-------------+

.. _EffectivePermissionComment:

EffectivePermissionComment
--------------------------

The effective access right for the current user for a CommentDr

.. code-block:: json

 message EffectivePermissionComment {
  bool change_comment_text = 1;
  bool delete_comment = 2;
  bool create_reply = 3;
  bool change_comment_status = 4;
  bool change_comment_visibility = 5;
  bool change_comment_assignment = 6;
 }

+-------------------------------+----------+-------------+
| Field                         | Type     | Description |
+===============================+==========+=============+
| ``change_comment_text``       | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``delete_comment``            | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``create_reply``              | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_comment_status``     | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_comment_visibility`` | ``bool`` |             |
+-------------------------------+----------+-------------+
| ``change_comment_assignment`` | ``bool`` |             |
+-------------------------------+----------+-------------+
