Add Menu::getPermission() and Menu::setPermission()
Those two functions are required for filtering menu items based on a user's grants. refs #8720
This commit is contained in:
parent
83443a5dc4
commit
0c30356d52
|
@ -75,6 +75,17 @@ class Menu implements RecursiveIterator
|
|||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* Permission a user is required to have granted to display the menu item
|
||||
*
|
||||
* If a permission is set, authentication is of course required.
|
||||
*
|
||||
* Note that only one required permission can be set yet.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $permission;
|
||||
|
||||
/**
|
||||
* Create a new menu
|
||||
*
|
||||
|
@ -442,15 +453,27 @@ class Menu implements RecursiveIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* Set required Permissions
|
||||
* Get the permission a user is required to have granted to display the menu item
|
||||
*
|
||||
* @param $permission
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPermission()
|
||||
{
|
||||
return $this->permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set permission a user is required to have granted to display the menu item
|
||||
*
|
||||
* If a permission is set, authentication is of course required.
|
||||
*
|
||||
* @param string $permission
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function requirePermission($permission)
|
||||
public function setPermission($permission)
|
||||
{
|
||||
// Not implemented yet
|
||||
$this->permission = (string) $permission;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue