Skip to content

OBPIH-6224 Fix permission issue on product supplier controller actions#4905

Merged
awalkowiak merged 1 commit intodevelopfrom
feature/OBPIH-6224-fix-permissions-on-product-sources-create-and-edit
Oct 22, 2024
Merged

OBPIH-6224 Fix permission issue on product supplier controller actions#4905
awalkowiak merged 1 commit intodevelopfrom
feature/OBPIH-6224-fix-permissions-on-product-sources-create-and-edit

Conversation

@drodzewicz
Copy link
Collaborator

@drodzewicz drodzewicz commented Oct 22, 2024

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket: OBPIH-6224

Description:
Make edit, create and delete to be available to users with admin and product manager permissions


📷 Screenshots & Recordings (optional)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.

…s edit, create and delete to be available to users with admin and product manager permissions
@drodzewicz drodzewicz self-assigned this Oct 22, 2024
@github-actions github-actions bot added type: feature A new piece of functionality for the app domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server flag: config change Hilights a pull request that contains a change to the app config labels Oct 22, 2024
def hasNoRoleProductManager = needProductManager(controllerName, actionName) && !userService.hasRoleProductManager(session.user)

if (isNotAuthenticated || isNotBrowser || isNotManager || isNotAdmin || isNotSuperuser || hasNoRoleInvoice || (isNotRequestorOrManager && !userService.hasHighestRole(session.user, session?.warehouse?.id, RoleType.ROLE_AUTHENTICATED) && !needAuthenticatedActions(controllerName, actionName)) || (isNotRequestor && userService.hasHighestRole(session.user, session?.warehouse?.id, RoleType.ROLE_AUTHENTICATED) && !needAuthenticatedActions(controllerName, actionName))) {
if (isNotAuthenticated || isNotBrowser || isNotManager || isNotAdmin || isNotSuperuser || hasNoRoleInvoice || hasNoRoleProductManager || (isNotRequestorOrManager && !userService.hasHighestRole(session.user, session?.warehouse?.id, RoleType.ROLE_AUTHENTICATED) && !needAuthenticatedActions(controllerName, actionName)) || (isNotRequestor && userService.hasHighestRole(session.user, session?.warehouse?.id, RoleType.ROLE_AUTHENTICATED) && !needAuthenticatedActions(controllerName, actionName))) {
Copy link
Collaborator

@awalkowiak awalkowiak Oct 22, 2024

Choose a reason for hiding this comment

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

This if check is getting ridiculous, but I guess it was not a matter of this ticket. Could we consider refactoring this in the near or far future?

@awalkowiak awalkowiak merged commit f767ac1 into develop Oct 22, 2024
@awalkowiak awalkowiak deleted the feature/OBPIH-6224-fix-permissions-on-product-sources-create-and-edit branch October 22, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server domain: frontend Changes or discussions relating to the frontend UI flag: config change Hilights a pull request that contains a change to the app config type: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants