-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathCustomerExtension.php
50 lines (42 loc) · 1.01 KB
/
CustomerExtension.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
<?php
namespace Oro\Bundle\CustomerBundle\Twig;
use Oro\Bundle\CustomerBundle\Security\CustomerUserProvider;
class CustomerExtension extends \Twig_Extension
{
const NAME = 'customer_extension';
/**
* @var CustomerUserProvider
*/
protected $securityProvider;
/**
* @param CustomerUserProvider $securityProvider
*/
public function __construct(CustomerUserProvider $securityProvider)
{
$this->securityProvider = $securityProvider;
}
/**
* {@inheritdoc}
*/
public function getFunctions()
{
return array(
'is_granted_view_customer_user' => new \Twig_Function_Method($this, 'isGrantedViewCustomerUser'),
);
}
/**
* @param string $object
* @return bool
*/
public function isGrantedViewCustomerUser($object)
{
return $this->securityProvider->isGrantedViewCustomerUser($object);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return self::NAME;
}
}