throw ApiException::
missingPrivileges($missingPrivileges);
} } /**
* @param WriteCommand[] $commands
*/
private function getPrivilegeForParentWriteOperation(WriteCommand
$command, array
$commands): string
{ $pathSuffix = '/translations/' . Uuid::
fromBytesToHex($command->
getPrimaryKey()['language_id'
]);
$parentCommandPath =
str_replace($pathSuffix, '',
$command->
getPath());
$parentCommand =
$this->
findCommandByPath($parentCommandPath,
$commands);
// writes to translation need privilege from parent command
// if we update e.g. a product and add translations for a new language
// the writeCommand on the translation would be an insert
if ($parentCommand) { return (string) $parentCommand->
getPrivilege();
} // if we don't have a parentCommand it must be a update,
// because the parentEntity must already exist
return AclRoleDefinition::PRIVILEGE_UPDATE;
}