Pimcore
Unpublished objects in controllers
Section titled “Unpublished objects in controllers”For requests that do not come from a logged-in admin session. Anyone can then reach unpublished objects on that route, so give it its own access check.
Pimcore 10
Section titled “Pimcore 10”use Pimcore\Model\DataObject;use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class SomeController extends AbstractController { #[Route('/data/{object}/get')] #[ParamConverter(name: 'object', options: ['unpublished' => true])] public function getDataAction(DataObject $object): Response {}}Pimcore 11 and 12
Section titled “Pimcore 11 and 12”use Pimcore\Model\DataObject;use Pimcore\Request\Attribute\DataObjectParam;
class SomeController extends AbstractController { #[Route('/data/{object}/get')] public function getDataAction( #[DataObjectParam(unpublished: true)] DataObject $object ): Response {}}Workflow place permissions
Section titled “Workflow place permissions”pimcore: workflows: my_workflow: places: my_place: permissions: - condition: "is_granted('ROLE_EDITOR')" publish: true delete: true - publish: false delete: falseThe first entry whose condition is true wins: here users with ROLE_EDITOR may publish and delete, and everyone else may not. ROLE_<ROLE NAME IN UPPERCASE> refers to a Pimcore role.
- Element permissions:
save,publish,unpublish,delete,rename,view,settings,versions,properties. modifyis shorthand forsave,publish,unpublish,deleteandrename.
Sources: Permissions, Configuration details.
Tinkerwell driver
Section titled “Tinkerwell driver”A custom driver, saved as .tinkerwell/PimcoreTinkerwellDriver.php in the project:
<?phpclass PimcoreTinkerwellDriver extends TinkerwellDriver{ public function canBootstrap($projectPath): bool { return file_exists($projectPath . '/vendor/pimcore/pimcore'); }
public function bootstrap($projectPath): void { require_once $projectPath . '/vendor/autoload.php';
\Pimcore\Bootstrap::setProjectRoot(); \Pimcore\Bootstrap::bootstrap(); \Pimcore\Bootstrap::kernel(); }
public function appVersion(): string { return 'Pimcore ' . \Composer\InstalledVersions::getPrettyVersion('pimcore/pimcore'); }
public function getAvailableVariables(): array { $kernel = \Pimcore::getKernel();
return [ 'kernel' => $kernel, 'container' => $kernel->getContainer()->get('test.service_container'), ]; }}Without the PsySH bundle the test container needs these services, for development only:
when@dev: services: test.service_container: class: Symfony\Bundle\FrameworkBundle\Test\TestContainer arguments: [ '@kernel', 'test.private_services_locator' ] public: true test.private_services_locator: class: Symfony\Component\DependencyInjection\ServiceLocator arguments: [ [] ] public: trueWhen the user not exists error occurs, add a user matching your host UID:
services: php: user: 'dev:dev' build: dockerfile_inline: | FROM pimcore/pimcore:php8.2-debug-latest RUN adduser --disabled-password --gecos '' --uid 1000 dev
