/
advanced_permissions.php
49 lines (42 loc) · 1.33 KB
/
advanced_permissions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Concrete\Controller\Dialog\Area\Edit;
use Concrete\Core\Error\UserMessageException;
use Concrete\Core\Permission\Key\Key as PermissionKey;
use Concrete\Core\Url\Resolver\Manager\ResolverManagerInterface;
class AdvancedPermissions extends \Concrete\Controller\Dialog\Area\Edit
{
protected $viewPath = '/dialogs/area/edit/advanced_permissions';
/**
* @var \Concrete\Core\Permission\Key\Key
*/
protected $permissionKey;
/**
* {@inheritdoc}
*
* @see \Concrete\Controller\Dialog\Area\Edit::on_start()
*/
public function on_start()
{
parent::on_start();
$pkID = $this->request->get('pkID');
$this->permissionKey = $pkID ? PermissionKey::getByID($pkID) : null;
if (!$this->permissionKey) {
throw new UserMessageException('Invalid Permission Key');
}
$this->permissionKey->setPermissionObject($this->area);
$this->set('pk', $this->permissionKey);
}
public function view()
{
$this->set('resolverManager', $this->app->make(ResolverManagerInterface::class));
}
/**
* {@inheritdoc}
*
* @see \Concrete\Controller\Dialog\Area\Edit::canAccess()
*/
protected function canAccess()
{
return parent::canAccess() && $this->areaPermissions->canEditAreaPermissions();
}
}