Merge pull request #316 from getgrav/feature/conform-to-authorize

Conform to authorize
This commit is contained in:
Andy Miller
2015-09-11 09:21:24 -06:00
2 changed files with 15 additions and 2 deletions

View File

@@ -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;
}
}

View File

@@ -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);
}
}