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

add user role/permission to module fd2_example #690

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nguyenbanhducA1K51
Copy link
Contributor

Pull Request Description
close #447

Add role/permission to login user, currently it must be imported in each module the same way like uid and name property. There could be a way to refactor so that every modules can have a common file to import from. Image below is from sub tab fd2_example, and I have remove that p tag in the commit, but the usage is straightforward.
Screenshot 2023-12-03 024447


Licensing Certification

FarmData2 is a Free Cultural Work and all accepted contributions are licensed as described in the LICENSE.md file. This requires that the contributor holds the rights to do so. By submitting this pull request I certify that I satisfy the terms of the Developer Certificate of Origin for its contents.

@braughtg
Copy link
Member

braughtg commented Dec 9, 2023

Having the demonstration of how to access the roles in the example would be great. Can you add those to the API example page again and include that in this PR? Place the displayed roles just below the username.

@nguyenbanhducA1K51
Copy link
Contributor Author

I have add illustration in latest commit, and here is the image
Screenshot 2023-12-11 022752
Screenshot 2023-12-11 022723

Copy link
Member

@braughtg braughtg left a comment

Choose a reason for hiding this comment

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

Nice work getting the roles added to the JS variables! Well done.

I added a comment about moving the illustration from the "Maps" example to the "Vars" example where it fits more naturally.

Also, there is a test file fd2_example/vars.uid.spec.js that tests that the JS variables for the user ID and username work correctly. Please extend the tests in that file to include assertions (.should) about the roles that the user has.

@braughtg braughtg marked this pull request as draft December 14, 2023 13:07
@nguyenbanhducA1K51
Copy link
Contributor Author

I have move it to var subtab and add some test fd2_example/vars.uid.spec.js
Screenshot 2023-12-14 162331

@nguyenbanhducA1K51 nguyenbanhducA1K51 marked this pull request as ready for review December 14, 2023 23:32
@braughtg
Copy link
Member

This all appears to be working well within the fd2_example module and the variables seem to have been added to the fd2_barn_kit module. To complete the work on this issue you'll need to add the variables to the fd2_field_kit and add tests to the cypress/fd2vars.spec.js in the fd2_barn_kit and fd2_field_kit modules (like the ones you added in the fd2_examples module) to be sure that the variables are functioning correctly in those modules as well.

@braughtg braughtg marked this pull request as draft December 27, 2023 19:57
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.

Accessing User Roles
2 participants