Browse Source

Added information on read_permissions and minor changes to documentation

Yentl Van Tendeloo 3 years ago
parent
commit
2e3114d841
3 changed files with 31 additions and 4 deletions
  1. 1 1
      doc/conf.py
  2. 11 3
      doc/modelling.rst
  3. 19 0
      doc/permissions.rst

+ 1 - 1
doc/conf.py

@@ -153,7 +153,7 @@ html_theme = 'default'
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+#html_static_path = ['_static']
 
 # Add any extra paths that contain custom files (such as robots.txt or
 # .htaccess) here, relative to this directory. These files are copied

+ 11 - 3
doc/modelling.rst

@@ -92,6 +92,7 @@ Create
         __12345
 
    The operation requires the model on which we are working, and the type of the element you want to instantiate.
+   Note that this type is specified by the ID of the model that is being instantiated.
    When successful, the operation returns the identifier that can be used in future operations.
    This identifier has no value within the model, and should only be used as a handle to that specific model element.
 
@@ -175,7 +176,10 @@ Read
         >>> read_outgoing("models/my_pn", "p1", "P2T")
         ["p2t"]
 
-   It is possible to get all outgoing associations as well, by leaving the type empty (the empty string).
+   It is possible to get all outgoing associations as well, by leaving the type empty (the empty string)::
+
+        >>> read_outgoing("models/my_pn", "p1", "")
+        ["p2t"]
 
 6. *read_incoming* similarly reads out all incoming associations of a certain type, for a specific element.
    For example, to read out all incoming T2P links of a place::
@@ -183,7 +187,10 @@ Read
         >>> read_incoming("models/my_pn", "p2", "T2P")
         ["t2p"]
 
-   Again, the type can be set to the empty string to return all incoming associations.
+   Again, the type can be set to the empty string to return all incoming associations::
+
+        >>> read_incoming("models/my_pn", "p2", "")
+        ["t2p"]
 
 7. *read_association_source* reads out the source of a specific association, and can be used in conjunction with *read_outgoing* and *read_incoming*.
    For example, to read out which is the source of an arc::
@@ -205,7 +212,8 @@ Read
         >>> connections_between("models/my_pn", "p1", "t1")
         ["P2T"]
 
-10. *all_instances* read out the set of all instances of a specific type in the model.
+10. *all_instances* reads out the set of all instances of a specific type in the model.
+    Again, inheritance information is taken into account.
     For example, to find all Places in our PetriNet model::
 
         >>> all_instances("models/my_pn", "Place")

+ 19 - 0
doc/permissions.rst

@@ -39,6 +39,25 @@ Models can be queried for their permission information with the *model_list_full
 In this case, user1 can modify my_pn, as he is the owner (permission 2: read/write), read my_pn2, as he is a member of group1 (permission 1: read), and has no access to my_pn3, as he is neither owner, nor in the group (permission 0: none).
 All users can read my_pn4, independent of their group (permission 1: read).
 
+In future versions of the Modelverse, an additional *executable* permission can be added.
+This permission will be checked before executing the activity or process model.
+For now, read permissions are equal to execution permissions, although this will in the future not always be the case.
+Indeed, read permissions allows users to open the model and read its contents (i.e., see how it does it), whereas execution permission allows users to execute it (i.e., see what it does).
+Both are distinct: one might want users to execute an activity, but not see how it is implemented (e.g., for protection of intellectual property).
+Vice versa, one might want users to open activities as a model, but not execute them (e.g., if the user does not have permissions to execute code on the server).
+
+For user-specific information on which operations are permitted, the operation *read_permissions* can be used.
+This operation returns either the empty string (no permissions), "R" (read permission), or "W" (read/write permission) for a single model, based on the user and the groups he is a member of::
+
+    >>> read_permissions("models/petrinets/my_pn")
+    "W"
+    >>> read_permissions("models/petrinets/my_pn2")
+    "R"
+    >>> read_permissions("models/petrinets/my_pn3")
+    ""
+    >>> read_permissions("models/petrinets/my_pn4")
+    "R"
+
 Folder permissions
 ^^^^^^^^^^^^^^^^^^