Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CommandAclValidationEvent example
$resource
=
$command
->
getDefinition
(
)
->
getParentDefinition
(
)
->
getEntityName
(
)
;
if
(
$privilege
!== AclRoleDefinition::PRIVILEGE_DELETE
)
{
$privilege
=
$this
->
getPrivilegeForParentWriteOperation
(
$command
,
$commands
)
;
}
}
if
(
!
$source
->
isAllowed
(
$resource
. ':' .
$privilege
)
)
{
$missingPrivileges
[
]
=
$resource
. ':' .
$privilege
;
}
$event
=
new
CommandAclValidationEvent
(
$missingPrivileges
,
$source
,
$command
)
;
$this
->eventDispatcher->
dispatch
(
$event
)
;
/** * @var list<string> $missingPrivileges */
$missingPrivileges
=
$event
->
getMissingPrivileges
(
)
;
}
$this
->
tryToThrow
(
$missingPrivileges
)
;
}
/** * @param list<string> $missingPrivileges */