Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPrivilegeForParentWriteOperation example
$resource
=
$command
->
getDefinition
(
)
->
getEntityName
(
)
;
$privilege
=
$command
->
getPrivilege
(
)
;
if
(
$privilege
=== null
)
{
continue
;
}
if
(
is_subclass_of
(
$command
->
getDefinition
(
)
, EntityTranslationDefinition::
class
)
)
{
$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 */