Skip to content

Commit f4b20af

Browse files
committed
documentation improvements (relates to #332 and #341)
1 parent 0ffb597 commit f4b20af

33 files changed

+547
-110
lines changed

CHANGES.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
.. explicit references must be used in this file (not references.rst) to ensure they are directly rendered on Github
12
.. :changelog:
23
34
Changes
4-
=======
5+
*******
56

67
`Unreleased <https://github.com/Ouranosinc/Magpie/tree/master>`_ (latest)
78
------------------------------------------------------------------------------------
@@ -31,7 +32,7 @@ Features / Changes
3132
specified with ``MAGPIE_CONFIG_PATH`` environment variable or ``magpie.config_path`` setting (example in ``configs``).
3233
* Add configurable user creation parameters upon `Magpie` application startup through configuration files
3334
(fixes `#47 <https://github.com/Ouranosinc/Magpie/issues/47>`_ and
34-
`#204 <https://github.com/Ouranosinc/Magpie/issues/204>`_).
35+
`#204 <https://github.com/Ouranosinc/Magpie/issues/204>`_).
3536
* Add disabled checkboxes for UI rendering of non-editable items
3637
(relates to `#164 <https://github.com/Ouranosinc/Magpie/issues/164>`_).
3738
* Add more tests to validate forbidden operations such as update or delete of reserved user and group details.
@@ -49,6 +50,9 @@ Features / Changes
4950
* Add support of new response content-type as XML.
5051
* Add support of ``Accept`` header and ``format`` query parameter for all API responses, for content-types variations
5152
in either plain text, HTML, XML or JSON (default), and include applicable values in schemas for Swagger generation.
53+
* Add documentation details about different types of ``Permission``, interaction between various `Magpie` models,
54+
glossary and other general improvements (relates to `#332 <https://github.com/Ouranosinc/Magpie/issues/332>`_ and
55+
`#341 <https://github.com/Ouranosinc/Magpie/issues/341>`_).
5256

5357
Bug Fixes
5458
~~~~~~~~~~~~~~~~~~~~~

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ docs-show: $(DOC_LOCATION) ## display HTML webpage of generated documentation (b
188188
@-test -f "$(DOC_LOCATION)" || $(MAKE) -C "$(APP_ROOT)" docs
189189
$(BROWSER) "$(DOC_LOCATION)"
190190

191-
## --- Versionning targets --- ##
191+
## --- Versioning targets --- ##
192192

193193
# Bumpversion 'dry' config
194194
# if 'dry' is specified as target, any bumpversion call using 'BUMP_XARGS' will not apply changes

README.rst

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. explicit references must be used in this file (not references.rst) to ensure they are directly rendered on Github
2+
13
======================================
24
Magpie: A RestFul AuthN/AuthZ service
35
======================================
@@ -69,9 +71,9 @@ Behind the scene, it uses `Ziggurat-Foundations`_ and `Authomatic`_.
6971

7072
.. end-badges
7173
72-
74+
--------------
7375
Documentation
74-
=============
76+
--------------
7577

7678
The REST API documentation is auto-generated and served under ``{MAGPIE_URL}/api/`` using Swagger-UI with tag ``latest``.
7779

@@ -81,8 +83,9 @@ The REST API documentation is auto-generated and served under ``{MAGPIE_URL}/api
8183
.. _readthedocs: https://pavics-magpie.readthedocs.io
8284
.. _docs: https://github.com/Ouranosinc/Magpie/tree/master/docs
8385

86+
----------------------------
8487
Configuration and Usage
85-
=======================
88+
----------------------------
8689

8790
| Multiple configuration options exist for ``Magpie`` application.
8891
| Please refer to `configuration`_ for details.
@@ -91,16 +94,17 @@ Configuration and Usage
9194
.. _configuration: ./docs/configuration.rst
9295
.. _usage: ./docs/usage.rst
9396

94-
97+
--------------
9598
Change History
96-
==============
99+
--------------
97100

98101
Addressed features, changes and bug fixes per version tag are available in `changes`_.
99102

100103
.. _changes: CHANGES.rst
101104

105+
--------------
102106
Docker Images
103-
=============
107+
--------------
104108

105109
Following most recent variants are available:
106110

@@ -126,6 +130,7 @@ Following most recent variants are available:
126130
- `Twitcher`_ image with integrated ``MagpieAdapter`` are only available for Magpie ``>=1.0.0``
127131

128132
.. REST API redoc reference is auto-generated by sphinx from magpie cornice-swagger definitions
133+
.. These reference must be left direct (not included) to allow pretty rendering on Github
129134
.. _REST API: https://pavics-magpie.readthedocs.io/en/latest/api.html
130135
.. _Authomatic: https://authomatic.github.io/authomatic/
131136
.. _PostgreSQL: https://www.postgresql.org/

SECURITY.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
***************
12
Security Policy
2-
===============
3+
***************
34

45
Supported Versions
5-
~~~~~~~~~~~~~~~~~~
6+
=====================
67

78
This project supports only the latest tagged version as it is constantly evolving.
89
Make sure you are using the latest available version to receive latest vulnerability patches if any.
910

1011
Reporting a Vulnerability
11-
~~~~~~~~~~~~~~~~~~~~~~~~~
12+
==========================
1213

1314
Please submit a new issue with the tag `security` and detail it so we can reproduce it and work on it.
1415

docs/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ BUILDDIR = _build
99

1010
# User-friendly check for sphinx-build
1111
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
12+
$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD " \
13+
"environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can " \
14+
"add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from " \
15+
"http://sphinx-doc.org/" \
16+
)
1317
endif
1418

1519
# Internal variables.

docs/_static/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# make this directory available as it is referenced by some extensions
22
*.*
33
!.gitignore
4+
!custom.css

docs/_static/custom.css

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
div.body p, div.body dd, div.body li, div.body blockquote {
2+
-moz-hyphens: none;
3+
-ms-hyphens: none;
4+
-webkit-hyphens: none;
5+
hyphens: none;
6+
}

docs/api.rst

Whitespace-only changes.

docs/conf.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def doc_redirect_include(file_path):
9494

9595
redoc = [{
9696
"name": __meta__.__title__,
97-
"page": "api", # rendered under '{root}/api.html'
97+
"page": "api", # rendered under "{root}/api.html"
9898
"spec": api_spec_file,
9999
"embed": True,
100100
"opts": {
@@ -161,7 +161,7 @@ def doc_redirect_include(file_path):
161161

162162
# List of patterns, relative to source directory, that match files and
163163
# directories to ignore when looking for source files.
164-
exclude_patterns = ["_build"]
164+
exclude_patterns = []
165165

166166
# The reST default role (used for this markup: `text`) to use for all
167167
# documents.
@@ -198,7 +198,9 @@ def doc_redirect_include(file_path):
198198
# Theme options are theme-specific and customize the look and feel of a
199199
# theme further. For a list of options available for each theme, see the
200200
# documentation.
201-
# html_theme_options = {}
201+
html_theme_options = {
202+
"navigation_depth": 3, # TOC, RTD theme
203+
}
202204

203205
# Add any paths that contain custom themes here, relative to this directory.
204206
# html_theme_path = []
@@ -224,15 +226,16 @@ def doc_redirect_include(file_path):
224226
# relative to this directory. They are copied after the builtin static files,
225227
# so a file named "default.css" will overwrite the builtin "default.css".
226228
html_static_path = ["_static"]
229+
html_css_files = ["custom.css"]
227230

228231
# Add any extra paths that contain custom files (such as robots.txt or
229232
# .htaccess) here, relative to this directory. These files are copied
230233
# directly to the root of the documentation.
231234
# html_extra_path = []
232235

233-
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
236+
# If not "", a "Last updated on:" timestamp is inserted at every page bottom,
234237
# using the given strftime format.
235-
# html_last_updated_fmt = '%b %d, %Y'
238+
html_last_updated_fmt = "%Y-%m-%d"
236239

237240
# If true, SmartyPants will be used to convert quotes and dashes to
238241
# typographically correct entities.
@@ -297,7 +300,7 @@ def doc_redirect_include(file_path):
297300
# (source start file, target name, title,
298301
# author, documentclass [howto, manual, or own class]).
299302
latex_documents = [
300-
("index", "{}.tex".format(__meta__.__package__), doc_title, __meta__.__author__, "manual"),
303+
(master_doc, "{}.tex".format(__meta__.__package__), doc_title, __meta__.__author__, "manual"),
301304
]
302305

303306
# The name of an image file (relative to this directory) to place at
@@ -326,7 +329,7 @@ def doc_redirect_include(file_path):
326329
# One entry per manual page. List of tuples
327330
# (source start file, name, description, authors, manual section).
328331
man_pages = [
329-
("index", __meta__.__package__, doc_title, [__meta__.__author__], 1)
332+
(master_doc, __meta__.__package__, doc_title, [__meta__.__author__], 1)
330333
]
331334

332335
# If true, show URL addresses after external links.
@@ -339,7 +342,7 @@ def doc_redirect_include(file_path):
339342
# (source start file, target name, title, author,
340343
# dir menu entry, description, category)
341344
texinfo_documents = [
342-
("index", __meta__.__package__,
345+
(master_doc, __meta__.__package__,
343346
doc_title,
344347
__meta__.__author__,
345348
__meta__.__package__,

docs/glossary.rst

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.. _glossary:
2+
.. include:: references.rst
3+
4+
************
5+
Glossary
6+
************
7+
8+
.. glossary::
9+
:sorted:
10+
11+
ACL
12+
Access Control List.
13+
Set of :term:`User` and :term:`Group` scopes, provided session :term:`Authentication` elements, that either
14+
grants or denies access to the applicable :term:`User` to the targeted HTTP request.
15+
16+
Authentication
17+
Process of identifying one-self using credentials in order to login into `Magpie`, or retrieving connected
18+
session :term:`User` during an HTTP request using supported methods.
19+
20+
Authorization
21+
Process of allowing or denying access to a :term:`Resource` or :term:`Service` according to :term:`Logged User`
22+
identified through :term:`Authentication` methods. This process typically falls into the hands of a
23+
:term:`Proxy` application.
24+
25+
Cookies
26+
Set of :term:`Authentication` identifiers primarily employed by `Magpie` HTTP requests to determine the
27+
:term:`Logged User`.
28+
29+
Direct Permission
30+
Describes a :term:`Permission` that originates directly from a :term:`Service`.
31+
See :ref:`direct permissions` details.
32+
33+
Discoverable Group
34+
:term:`Group` that has property ``discoverable=True``, making it publicly viewable to any-level user.
35+
Otherwise, groups can be listed or accessed only by administrators.
36+
37+
Effective Permission
38+
A :term:`Permission` that has been completely resolved according to all applicable contexts, that indicates
39+
the final granted or denied result. See also :ref:`effective permissions`.
40+
41+
Group
42+
Entity on which :term:`Permission` over a :term:`Service` or :term:`Resource` can be applied. Any :term:`User`
43+
can be set as a member of any number of :term:`Group`, making it inherit all applicable set of
44+
:term:`Permission`.
45+
46+
Inherited Permission
47+
Describes a :term:`Permission` that originates from a children :term:`Resource` under a :term:`Service`.
48+
See :ref:`inherited permissions` details.
49+
50+
Logged User
51+
Specific :term:`User` that corresponds to the active request session. This :term:`User` can automatically be
52+
referenced to (instead of usual ``{user_name}`` path variable) in applicable requests using special value
53+
configured with :py:data:`magpie.constants.MAGPIE_LOGGED_USER`. When not logged in, this
54+
:term:`User` is considered to be :py:data:`magpie.constants.MAGPIE_ANONYMOUS_USER`. Otherwise, it is whoever
55+
the :term:`Authentication` mechanism identifies.
56+
57+
Permission
58+
Element that defines which rules are applicable for a given combination of :term:`User` and/or :term:`Group`
59+
against one or many :term:`Service` and/or :term:`Resource`. See `permissions`_ for more exhaustive details.
60+
Applicable values defined by enum :py:class:`magpie.permissions.Permission`.
61+
62+
Proxy
63+
Sibling service (typically `Twitcher <Twitcher>`_) that employs `Magpie` as access management of :term:`User`,
64+
:term:`Group`, :term:`Service` and :term:`Resource` to obtain applicable sets of :term:`Permission`.
65+
Provided these, it acts as policy enforcement point (PEP).
66+
67+
Public
68+
Refers to a :term:`Permission` applied on a :term:`Service` or :term:`Resource` to special elements in order
69+
to make them available to anyone including even unauthenticated sessions. See also :ref:`Public Access` section
70+
for implementation details to achieve this result.
71+
72+
Resource
73+
Entity on which :term:`User` and :term:`Group` can be associated to applicable :term:`Permission` respectively
74+
for the contextual :term:`Service` under which it resides. This element can represent relatively *anything*.
75+
The interpretation of each :term:`Resource` depends on the context of the :term:`Service` they relate to.
76+
Implemented by sub-classes of :py:class:`magpie.models.Resource`.
77+
78+
Service
79+
Top-level specialized :term:`Resource` that defines which children :term:`Resource` elements are applicable to
80+
it (if any), how its hierarchy of :term:`Resource` should behave against incoming HTTP request details, and how
81+
to parse any set of :term:`Permission` applied on them against respective request elements. Also defines URL
82+
connexion details pointing to the actual service on which access control are applicable. Each type of
83+
:term:`Service` defines different combination of functionalities. Implemented by sub-classes of
84+
:py:class:`magpie.models.ServiceInterface`.
85+
86+
User
87+
Unitary entity containing details about the user allowing it to log into `Magpie` and that can have other
88+
relationships applied to it such as :term:`Permission` and :term:`Group` that extend his specific access rights
89+
to :term:`Service` and :term:`Resource` elements. Implemented by :py:class:`magpie.models.User`.
90+
91+
92+
.. _permissions: permissions.rst
93+

docs/index.rst

+3-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
1-
Magpie Documentation
2-
======================================
3-
41
.. include:: ../README.rst
5-
6-
Package Information
7-
===================
8-
9-
.. toctree::
10-
:maxdepth: 2
11-
12-
usage
13-
installation
14-
configuration
15-
utilities
16-
performance
17-
contributing
18-
authors
19-
changes
20-
security
21-
22-
23-
Source Code
24-
===================
25-
26-
.. toctree::
27-
:maxdepth: 2
2+
.. include:: toc.rst
283

294

5+
----------------------------
306
Indices and Tables
31-
==================
7+
----------------------------
328

339
* :ref:`genindex`
3410
* :ref:`modindex`
3511
* :ref:`search`
36-

docs/installation.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
.. _installation:
2+
.. include:: references.rst
3+
4+
************
15
Installation
2-
============
6+
************
37

48
At the command line::
59

docs/performance.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
===========
1+
.. _performance:
2+
.. include:: references.rst
3+
4+
*************
25
Performance
3-
===========
6+
*************
47

58
Requesting permissions for a specific user and service can be demanding if a lot of
6-
requests are done rapidly. PostgreSQL and sqlalchemy are usually fast enough, but
9+
requests are done rapidly. `PostgreSQL`_ and `SQLAlchemy`_ are usually fast enough, but
710
when more than a couple requests per second are needed, some solutions are possible to
811
improve the performance of these requests.
912

0 commit comments

Comments
 (0)