-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSystemCalendarEventGridHelper.php
55 lines (49 loc) · 1.53 KB
/
SystemCalendarEventGridHelper.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
50
51
52
53
54
55
<?php
namespace Oro\Bundle\CalendarBundle\Datagrid;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecordInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class SystemCalendarEventGridHelper
{
/** @var AuthorizationCheckerInterface */
protected $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
/**
* Returns callback for configuration of grid/actions visibility per row
*
* @return callable
*/
public function getPublicActionConfigurationClosure()
{
return function (ResultRecordInterface $record) {
if ($this->authorizationChecker->isGranted('oro_public_calendar_management')) {
return [];
} else {
return [
'update' => false,
'delete' => false,
];
}
};
}
/**
* Returns callback for configuration of grid/actions visibility per row
*
* @return callable
*/
public function getSystemActionConfigurationClosure()
{
return function (ResultRecordInterface $record) {
if ($this->authorizationChecker->isGranted('oro_system_calendar_management')) {
return [];
} else {
return [
'update' => false,
'delete' => false,
];
}
};
}
}