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

Refactor permissionsCheck and test #111

Merged

Conversation

YotaYota
Copy link
Contributor

@YotaYota YotaYota commented Jun 1, 2024

Refactored permissionsCheck.js and added test file permissionsCheck.test.js.

@YotaYota
Copy link
Contributor Author

YotaYota commented Jun 1, 2024

I noticed 2 things about permissions that's worth noticing:

  • methods and endpoints on the permissions object are not used
  • Since permission check just loads from local storage, I guess a user can modify it to see more things (I guess there's a check in backend as well)? 😱

But I've been looking at local storage in norpan; and there is no "permissions" set there, so there's probably a part of the puzzle that I've missed.

Copy link

sonarcloud bot commented Jun 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

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

See analysis details on SonarCloud

@indy-independence
Copy link
Member

methods and endpoints are only used by the python API I think, and the things saved in local storage is only what menus to display it doesn't control what you actually can do so I think it's fine like that
@Josephine-Rutten maybe has input on the refactor things?

@Josephine-Rutten
Copy link
Contributor

Yeah indeed, at first the idea was to use methods and endpoint on the front and backend, but working with pages and permissions on the frontend seems a bit more user friendly. We could filter this out in the backend so we don't give back methods and endpoints, but might also be useful when debugging. If you see an improvement here, please let me know.

The real permission checks happen in the backend, in the frontend the goal is mostly to make sure the user doesn't see options that they can't use.

The refactor looks great, haven't tested it, but big code improvement and great to have some unit testing as well.

@indy-independence indy-independence merged commit 82b98f6 into SUNET:develop Jun 12, 2024
2 checks passed
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.

3 participants