Protect preference and navigation from guests

This is an implicit allowance to the user/* permission space, for any logged in user.

refs #11281
This commit is contained in:
Markus Frosch 2016-03-02 22:35:03 +01:00
parent bb03262855
commit a327c93200
3 changed files with 18 additions and 0 deletions

View File

@ -35,6 +35,8 @@ class NavigationController extends Controller
{
parent::init();
$this->itemTypeConfig = Navigation::getItemTypeConfiguration();
$this->assertPermission('user/navigation');
}
/**

View File

@ -18,6 +18,16 @@ use Icinga\Web\Widget\Tab;
*/
class PreferenceController extends BasePreferenceController
{
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
$this->assertPermission('user/preference');
}
/**
* Create tabs for this preference controller
*

View File

@ -457,6 +457,12 @@ class User
return true;
}
// the user/* context is available for all default users
// TODO: verify security! (admin?)
if (!$this->isGuest() and strpos($requiredPermission, 'user/') === 0) {
return true;
}
$requiredWildcard = strpos($requiredPermission, '*');
foreach ($this->permissions as $grantedPermission) {
if ($requiredWildcard !== false) {