Download the PHP package perspeqtive/sulu-permission-aware-templates-bundle without Composer
On this page you can find all versions of the php package perspeqtive/sulu-permission-aware-templates-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download perspeqtive/sulu-permission-aware-templates-bundle
More information about perspeqtive/sulu-permission-aware-templates-bundle
Files in perspeqtive/sulu-permission-aware-templates-bundle
Package sulu-permission-aware-templates-bundle
Short Description Adds permissions to templates
License proprietary
Informations about the package sulu-permission-aware-templates-bundle
Sulu Permission Aware Templates Bundle
This bundle adds permission-aware page templates to the Sulu admin.
It registers a security context for every available Sulu page template and uses these permissions to restrict the template dropdown and the page toolbar actions. This makes it possible to decide per role which templates can be selected, changed, saved, published, unpublished, or deleted.
✨ Features
- Adds a dedicated Sulu security context for page templates.
- Restricts the page template dropdown to templates the current user is allowed to use.
- Keeps the currently selected template visible, even if the user is not allowed to switch to another one.
- Disables save, publish and unpublish actions when the current template is not writable for the current user.
- Disables delete actions when the current template is not deletable for the current user.
- Supports toolbar actions inside Sulu dropdown toolbar actions.
📋 Requirements
- PHP 8.2 or higher
- Sulu 2.6 or higher
⚙️ Installation
Install the bundle via composer:
Enable the bundle
If your application does not use Symfony Flex, register the bundle manually:
Add the bundle to package.json
In order to enable visibility- and disabled-checks for toolbar actions, you need to register the bundle in your package.json:
Import the bundle
Rebuild the admin JS
Clear the cache
Clear the cache after installing the bundle:
🔐 Permissions
After installation, Sulu contains a new Templates security section. Every page template is registered with its own security context:
The permission behavior is:
| Permission | Behavior |
|---|---|
add |
The user may edit a content page that already uses the template, but cannot change the template. |
write |
The user may select the template in the dropdown and may change an existing page to this template. The user may also save, publish and unpublish pages using this template. |
delete |
The user may delete a content page that uses this template. |
⚠️ Important: Users without the required template permission can still edit content pages they are allowed to access, but the template-related actions are restricted by the permissions above.
Internally the bundle maps these checks to Sulu's template security permissions:
| Sulu permission | Used for |
|---|---|
add |
Template dropdown availability |
edit |
Save, publish and unpublish toolbar actions |
delete |
Delete toolbar action |
⚠️ Important: After changing the permissions, you need to clear the browser cache (F5) for the changes to take effect.
🧩 Usage
No additional configuration is required. The bundle reads the available page templates from Sulu's page form metadata and registers matching security contexts automatically.
Assign the permissions in the Sulu role settings:
- Open the Sulu admin.
- Go to
Settings>Roles. - Select a role.
- Configure the permissions in
Sulu>Templates. - Save the role.
The page editor then applies the permissions automatically:
- Users without
writepermission only see templates they may keep or select. - Users with access to a page may still edit the page content.
- Users without
writepermission for the current template cannot save, publish or unpublish that page. - Users without
deletepermission for the current template cannot delete that page.
⚠️ Important: After changing the permissions, you need to clear the browser cache (F5) for the changes to take effect.
🤝 Contribution
Please feel free to fork and extend existing or add new features and send a pull request with your changes. To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.