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

Dev 18809 make set user access atomical #22931

Draft
wants to merge 8 commits into
base: 5.2.x-dev
Choose a base branch
from

Conversation

caddoo
Copy link
Contributor

@caddoo caddoo commented Jan 14, 2025

Description:

Please include a description of this change and which issue it fixes. If no issue exists yet please include context and what problem it solves.

Review

$success = $this->model->updateUserAccessConditionally($userLogin, $idSite, $role, $previousAccess);
if ($success === false) {
throw new Exception('Concurrency problem');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess at this point we would need to remove all capabilities that were set for a specific site, as deleteUserAccess is no longer called upfront. If there are new capabilities that should be set, that will happen below.

Another possibility is to iterate over each site, check which capabilities are already set and which should be set. And based on a diff remove or add capabilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgiehl can you elaborate why need to remove all capabilities here, why would new capabilities have to be set if the exception is thrown?

The flows are either:

  • Update role fails - capabilities don't get touched.
  • Update role is successful - capabilities get updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants