Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
16.0: Document UI Property Permissions #6971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
16.0: Document UI Property Permissions #6971
Changes from all commits
d65fa04d1140f4f19965b180d6e9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
UI Property Permissions
The UI Property Permissions are used to restrict access to specific properties in the Backoffice UI.
Document Property Value User Permissions
Out of the box, Umbraco provides a feature called Document Property Value User Permissions. This feature can restrict access to specific Document property values for certain user groups. By default, all the built-in User Groups have read and write permissions for all properties. However, you can limit a User Group's permissions for specific properties through the UI.
If a User Group does not have write access to a property, the property will be read-only for that User Group. If a User Group does not have read access to a property, the property will be hidden from that User Group.
Be aware that the Document Property Value User Permissions are not enforced on the server side. This means that a user can still access the property value through the API, even if the property is restricted in the UI.
Extending the Document Property Value User Permission with additional restrictions
In addition to the User Permission logic, it is possible to add further restrictions to properties. This can be achieved through the
propertyReadOnlyState-Manager available in property-based Workspace Contexts. In the following example, we will make all invariant properties read-only.Register a Workspace Context
Register a Workspace Context to append additional restrictions to properties.
Manifest
Implement custom logic for Property Value Permissions
Implement custom logic to identify all properties and add a read-only state for each one. To target a property, we use its unique identifier along with the variant ID that corresponds to that property. In the following example, we will focus specifically on the invariant properties.
Workspace Context
Custom logic For Property value permissions
It is also possible to implement completely custom UI logic for managing property value permissions. To do this, you first need to remove the default read and write access to properties for the user group. As a result, all properties will be hidden from that user group. Afterward, you can create custom logic to determine whether a specific user group should have access to particular properties.
We follow the same concept as the previous example, but instead of writing to the
propertyReadOnlyState-Manager, we can use thepropertyViewState-Manager and thepropertyWriteState-Manager to control the view- and writability of properties.In the following example, we will hide a specific property based on the property alias.
Register a workspace context for the Document Workspace
For the manifest, we can use the same manifest as the previous example.
Implement custom logic for Property Value Permissions
Implement custom logic to identify all properties and add a view and write state for each one.