01.
public
function
subscribeEvents()
02.
{
03.
Backend::
$events
->addEvent(
'cms:onApplyPageSecurity'
,
$this
,
'apply_security'
);
04.
}
05.
06.
public
function
apply_security(
$page
,
$params
)
07.
{
08.
if
(
$page
->url !==
'my-secure-page'
)
09.
return
;
10.
11.
12.
13.
14.
$customer
= Cms_Controller::get_customer();
15.
if
(!
$customer
||
$customer
->first_name !=
'John'
)
16.
Phpr::
$response
->redirect(
'/login'
);
17.
}