Introduce event to handle different object edit lock tasks #448
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.
About this contribution
According to the contribution rules in pimcore README.md file I made an attempt to ask on Gitter channel last June if this might be an interesting feature - without success. CONTRIBUTING.md on the other hand does not explicitly state how to contribute new feature besides doing a fork for pull requests which I try now 😉
Current Situation
The current implementation has a fix behavior in case of parallel access of objects by users in admin UI. The first user opens the object and it gets a lock entry. The second user is prompted to take over this lock.
My issue is that I need a more flexible implementation to have the possibility to keep the lock and e.g. offer the object for the second user in read only mode.
Changes in this pull request
This PR introduces a new event which is triggered in case of user tries to open a locked object. Based on the event the implementation can decide to
Additional actions (like ensure read only access) can anyhow be taken at the pre edit event
pimcore.admin.dataobject.get.preSendData
Additional info
New admin event
pimcore.admin.dataobject.get.isLocked
is introduced which supports a parametertask
with following possible values:TASK_RESPONSE = 'response';
Default: On active edit lock answer with editlock response as up to now
TASK_OVERWRITE = 'overwrite';
On active edit lock overwrite it with new user
TASK_KEEP = 'keep';
On active edit lock keep existing entry, further actions are up to the implementation
This task will be executed when event returns