Skip to content
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

Introduce event to handle different object edit lock tasks #448

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

APochmann
Copy link
Contributor

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

  • Offer the dialog as up to now to override the lock
  • Keep the existing lock
  • Override the lock without asking the user

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 parameter task 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

Copy link

sonarqubecloud bot commented Mar 1, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@robertSt7 robertSt7 self-assigned this Apr 5, 2024
@robertSt7 robertSt7 added this to the 1.5.0 milestone Apr 12, 2024
@robertSt7 robertSt7 merged commit 0445521 into pimcore:1.x Apr 12, 2024
8 checks passed
@robertSt7
Copy link
Contributor

Hi @APochmann we very much appreciate your PR, thank you for your contribution

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants