summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/authorization.rst
diff options
context:
space:
mode:
authorPatricio Paez <pp@pp.com.mx>2012-04-08 07:34:21 -0500
committerPatricio Paez <pp@pp.com.mx>2012-04-08 07:34:21 -0500
commitc226b1ae080aa7d19c47626b07fe6d8ef6bbba9e (patch)
tree97ec2feb0c9a1afacb26886bb8b53145e5d53cec /docs/tutorials/wiki2/authorization.rst
parent6c3dd2f690c1a92aaf396d44f4b9450a477a67fc (diff)
downloadpyramid-c226b1ae080aa7d19c47626b07fe6d8ef6bbba9e.tar.gz
pyramid-c226b1ae080aa7d19c47626b07fe6d8ef6bbba9e.tar.bz2
pyramid-c226b1ae080aa7d19c47626b07fe6d8ef6bbba9e.zip
Normalize Authorization in both tutorials 3
- Sync content in Adding Authentication and Authorization policies, Add permission declarations sections - Added mising permission=view in SQL tutorial - Moved __init__.py listing to Seeing our changes
Diffstat (limited to 'docs/tutorials/wiki2/authorization.rst')
-rw-r--r--docs/tutorials/wiki2/authorization.rst18
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst
index 75037da5f..0bf50f674 100644
--- a/docs/tutorials/wiki2/authorization.rst
+++ b/docs/tutorials/wiki2/authorization.rst
@@ -160,7 +160,7 @@ Note that the
accepts two arguments: ``secret`` and ``callback``. ``secret`` is a string
representing an encryption key used by the "authentication ticket" machinery
represented by this policy: it is required. The ``callback`` is the
-``groupfinder()`` function the we created before.
+``groupfinder()`` function that we created before.
Add permission declarations
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -180,6 +180,20 @@ decorator for ``add_page()`` and ``edit_page()``, for example:
The result is that only users who possess the ``edit``
permission at the time of the request may invoke those two views.
+Add a ``permission='view'`` parameter to the ``@view_config``
+decorator for ``view_wiki()`` and ``view_page()``, like this:
+
+.. code-block:: python
+ :linenos:
+ :emphasize-lines: 2
+
+ @view_config(route_name='view_page', renderer='templates/view.pt',
+ permission='view')
+
+(Only the highlighted line needs to be added.)
+
+This allows anyone to invoke these two views.
+
We are done with the changes needed to control access. The
changes that follow will add the login and logout feature.
@@ -336,7 +350,7 @@ when we're done:
.. literalinclude:: src/authorization/tutorial/views.py
:linenos:
- :emphasize-lines: 11,14-18,56,59,71,74,86,89-115,117-121
+ :emphasize-lines: 11,14-18,31,37,58,61,73,76,88,91-117,119-123
:language: python
(Only the highlighted lines need to be added.)