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

OBPIH-4001 Make admin, manager, assistant be able to delete pending POs #3388

Merged
merged 2 commits into from
Aug 4, 2022

Conversation

kchelstowski
Copy link
Collaborator

The main problem to fix was that the Delete order button was visible only for superusers and that I had to figure out how to prevent <g:link> of disabling the button after making is visible not only for superusers.
Deleting now works for role at least Assistant, so for roles: Superuser, Admin, Manager, Assistant.

<g:supports activityCode="${ActivityCode.PLACE_ORDER}">
<g:if test="${orderInstance?.orderType == PURCHASE_ORDER}">
<g:supports activityCode="${ActivityCode.PLACE_ORDER}">
<g:isSuperuser>
Copy link
Member

Choose a reason for hiding this comment

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

Since this was already there we can leave (and refactor later) but just wanted to point out that this could be a performance issue since _actions.gsp is likely being rendered for each order on the List Orders page. The max results parameter is usually set to 10, so this would be rendered at most 10 times. But it's still not great, especially since it's being called multiple times within the _actions.gsp and each time it's called there are likely database queries involved.

Copy link
Member

Choose a reason for hiding this comment

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

With that said, I don't know the best approach here. I think Spring Security uses a thread local to store the authenticated user and their authorities. We do something similar with AuthService but it's not widely used and as far as I can remember I don't think it's being invoked in g:isSuperuser.

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.

None yet

3 participants