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

UIU-2967 Don't display affiliations of users with types patron or dcb #2570

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

usavkov-epam
Copy link
Contributor

@usavkov-epam usavkov-epam commented Oct 16, 2023

Purpose

https://issues.folio.org/browse/UIU-2967

When changing a user type from staff to patron - affiliations are deleted on BE side and it results in an error when querying users' tenants. So for for users with types patron or dbc (a new user type, that isn't meant to work with affiliations) "Affiliations" selector should be hidden in the permissions accordion and the related query to fetch user affiliations should be disabled.

Approach

Prevent fetching affiliations if a user type is a patron or dcb. Hide the "Affiliations" selection for those types in the user edit form.

Screenshots

chrome_zurqK9Yhn2.mp4

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

@usavkov-epam usavkov-epam self-assigned this Oct 16, 2023
@usavkov-epam usavkov-epam requested review from a team October 16, 2023 11:55
@alisher-epam
Copy link
Contributor

@usavkov-epam Please also update package.json version as well

CHANGELOG.md Outdated
Comment on lines 5 to 6
* Don't display affiliations of users with types `patron` or `dbc`. Refs UIU-2967.

Copy link
Contributor

Choose a reason for hiding this comment

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

This one seems to be a target for Poppy bugfix. Please update the version in progress accordingly

Copy link
Member

Choose a reason for hiding this comment

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

Generally, our practice is to target all changes to the master branch and then to cherry-pick fixed onto patch branches. If somebody else's PR hits master before yours lands, you'll have to do this anyway, so I just plan for things to work out this way. I would do it like this:

  1. Bump the version on master in package.json to 10.1.0. You'll save a PR later if you do it in a separate PR now, but it's up to you.
  2. Merge this PR.
  3. Split a release branch named b10.0 from the commit where master was tagged and push it up so others can also pick bug fixes onto : (get checkout master; git checkout -b b10.0 v10.0.0; git push -u origin head).
  4. If you bumped the version in step 1 in a separate PR, you can just pick the commit from this PR onto your release branch: git cherry-pick -x SOME_HASH; git push, you're done! If you bumped the version in step 1 in this PR, you'll need to split a branch from b10.0, pick this fix onto it, fix the version in package.json, push the branch and open a PR with a target of b10.0.

@Terala-Priyanka
Copy link
Contributor

@usavkov-epam Thank you for including DCB type along with patron.

@zburke zburke changed the title UIU-2967 Don't display affiliations of users with types patron or dbc UIU-2967 Don't display affiliations of users with types patron or dcb Oct 16, 2023
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

LGTM. Test coverage is reported at 100% which is a little hard to believe given there are no changes to tests here and the DCB constant is new :/ It would be nice to test the utility functions directly, even if isAffiliationsEnabled is covered in the course of testing other functionality.

Comment on lines +204 to +209
export const isPatronUser = (user) => user?.type === USER_TYPES.PATRON;
export const isDcbUser = (user) => user?.type === USER_TYPES.DCB;

export const isAffiliationsEnabled = (user) => {
return !isPatronUser(user) && !isDcbUser(user);
};
Copy link
Member

Choose a reason for hiding this comment

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

Please add tests. I know these functions are dead-simple. At least the tests will be dead-simple too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I've added.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@usavkov-epam usavkov-epam merged commit 5f8f25f into master Oct 17, 2023
4 checks passed
@usavkov-epam usavkov-epam deleted the UIU-2967 branch October 17, 2023 08:44
usavkov-epam added a commit that referenced this pull request Oct 18, 2023
…dcb` (#2570)

* UIU-2967 Don't display affiliations of users with types 'patron' or 'dbc'

* PT comment

* add tests

* import order

* fix type naming
usavkov-epam added a commit that referenced this pull request Oct 18, 2023
…dcb` (#2570)

* UIU-2967 Don't display affiliations of users with types 'patron' or 'dbc'

* PT comment

* add tests

* import order

* fix type naming
Terala-Priyanka added a commit that referenced this pull request Dec 5, 2023
…irtual item. (#2601)

* UIU-2967 Don't display affiliations of users with types `patron` or `dcb` (#2570)

* UIU-2967 Don't display affiliations of users with types 'patron' or 'dbc'

* PT comment

* add tests

* import order

* fix type naming

* UIU-2970 Make the `username` field required for users with the `staff` type in "ECS" mode (#2571)

* UIU-2970 Make the 'username' field required for users with the 'staff' type in ECS mode

* add unit tests

* Release v10.0.1 (#2574)

* Release v10.0.2 (#2577)

* Release v10.0.3

* Release v10.0.4 (#2586)

* UIU-2977 x-okapi-token header must always be optional (#2578)

The `X-Okapi-Token` header is optional and should only be included when
a token value is present on the `stripes.okapi` object.

Refs UIU-2977

* UIU-2959 Accordion collapse/expand all shortcuts not working on Edit form. (#2566)

* use handlers frome stripes-components

* update yarn.lock

* log changes

* update yarn lock

* UIU-2973 - Update patron groups retrieval in user search to hold maxUnpagedResourceCount (#2583)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter (#2584)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter

* UIU-2995 - Upade changelog description

* UIU-2955 - add a header comment to escapeSpecialCharactersInTagFilters function

* Add the possibility to do "Claim returned" from action menu (#2585)

* Release v10.0.4

---------

Co-authored-by: Zak Burke <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>

* UIU-2964 - [DCB] Loan details: Disable loan actions (Lending library) (#2590)

* UIU-3000 Can not edit shadow user account (#2589)

* Release v10.0.5 (#2593)

* UIU-2987-poppy-dcb - Hide all actionalble buttons on user details pane (#2594)

* UIU-2987-poppy-dcb - Hide all actionalble buttons on user details pane

* UIU-2987-poppy-dcb - fix unit test failure

* UIU-2987-poppy-dcb - fix lint error

* UIU-2988-poppy-dcb - User - Open Loans: UI changes for supporting DCB circulation (#2598)

* UIU-2966-poppy-dcb - display item title and barcode as text for dcb virtual item.

---------

Co-authored-by: Yury Saukou <[email protected]>
Co-authored-by: Zak Burke <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>
Co-authored-by: Mikita Siadykh <[email protected]>
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.

4 participants