mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 15:29:57 +01:00
Merge pull request #316 from getgrav/feature/conform-to-authorize
Conform to authorize
This commit is contained in:
@@ -538,7 +538,7 @@ class TwigExtension extends \Twig_Extension
|
||||
$action = (array)$action;
|
||||
|
||||
foreach ($action as $a) {
|
||||
if ($this->grav['user']->authorise($a)) {
|
||||
if ($this->grav['user']->authorize($a)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class User extends Data
|
||||
* @param string $action
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($action)
|
||||
public function authorize($action)
|
||||
{
|
||||
if (empty($this->items)) {
|
||||
return false;
|
||||
@@ -125,4 +125,17 @@ class User extends Data
|
||||
|
||||
return $this->get("access.{$action}") === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks user authorization to the action.
|
||||
* Ensures backwards compatibility
|
||||
*
|
||||
* @param string $action
|
||||
* @deprecated use authorize()
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($action)
|
||||
{
|
||||
$this->authorize($action);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user