Skip to content

Commit

Permalink
Add a ref instead of a relative link
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 12, 2023
1 parent ee635d7 commit ee1dd15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions docs/en/component.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ the component::
// Rest of the edit method.
}

Above we see an article being authorized for the current user. Since we haven't
Above we see an article being authorized for the current user. Since we haven't
specified the action to check the request's ``action`` is used. You can specify
a policy action with the second parameter::

Expand All @@ -74,6 +74,8 @@ authorization for anonymous users. Both the ``can()`` and ``authorize()`` suppor
anonymous users. Your policies can expect to get ``null`` for the 'user' parameter
when the user is not logged in.

.. _applying-policy-scopes:

Applying Policy Scopes
======================

Expand All @@ -84,7 +86,7 @@ $query = $this->Authorization->applyScope($this->Articles->find());
If the current action has no logged in user a ``MissingIdentityException`` will
be raised.

If you want to map actions to different authorization methods use the
If you want to map actions to different authorization methods use the
``actionMap`` option::

// In your controller initialize() method:
Expand All @@ -109,7 +111,7 @@ Example::
$query = $this->Articles->find();

//this will apply `list` scope while being called in `index` controller action.
$this->Authorization->applyScope($query);
$this->Authorization->applyScope($query);
...
}

Expand All @@ -118,14 +120,14 @@ Example::
$article = $this->Articles->get($id);

//this will authorize against `remove` entity action while being called in `delete` controller action.
$this->Authorization->authorize($article);
$this->Authorization->authorize($article);
...
}

public function add()
{
//this will authorize against `insert` model action while being called in `add` controller action.
$this->Authorization->authorizeModel();
$this->Authorization->authorizeModel();
...
}

Expand Down
6 changes: 4 additions & 2 deletions docs/en/policies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ Before hooks are expected to return one of three values:
- ``false`` The user is not allowed to proceed with the action.
- ``null`` The before hook did not make a decision, and the authorization method
will be invoked.

Applying Policies
-----------------
See `Applying Policy Scopes <component.html#applying-policy-scopes>`_ for how to apply policies in your controller actions.

See :ref:`applying-policy-scopes` for how to apply policies in your controller
actions.

0 comments on commit ee1dd15

Please sign in to comment.