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

feat: #1537 create an api to return audit information #1587

Merged
merged 42 commits into from
Sep 13, 2024

Conversation

craigyu
Copy link
Collaborator

@craigyu craigyu commented Sep 6, 2024

Closes: #1537

Adds a GET endpoint /permission-audit-history

Tests are also added, router tests are isolated by mocking the data returned from the crud function.
Crud tests are still interacting with the DB.

image

Thanks reviewers, changes are applied as requested.

For permission_type and scope_type, I opted to use the human friendly format.
I've highlighted the new changes in the comments below so it's easier to find

@craigyu craigyu linked an issue Sep 6, 2024 that may be closed by this pull request
4 tasks
@craigyu
Copy link
Collaborator Author

craigyu commented Sep 6, 2024

@ianliuwk1019 I definitely see what you meant by grouping some schemas now, I have 3 schemas under priviledge_detail.py 👀. I think we can have rule where if a schema is only used for another schema, then it can be under the same file, what do you think of that?

I won't be doing more schema changes here in order to keep this PR relatively small. I can do that if we have more time by the end of the sprint.

Copy link
Collaborator

@ianliuwk1019 ianliuwk1019 left a comment

Choose a reason for hiding this comment

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

Thanks Craig!

Just some information. In the past, (although I copy-paste the model class for the need but) I think Catherine sometimes used sqlacodegen tool to generated them to use.
This is the command to generate when you have db up: sqlacodegen --generator declarative postgresql+psycopg2://postgres:postgres@localhost:5432/fam --schemas app_fam > ./api/app/models/model.py (was documented in one of the past ticket). See if it is easier for you.

server/backend/api/app/models/model.py Show resolved Hide resolved
server/backend/api/app/models/model.py Show resolved Hide resolved
server/backend/api/app/models/model.py Outdated Show resolved Hide resolved
server/backend/api/app/models/model.py Show resolved Hide resolved
server/backend/api/app/models/model.py Outdated Show resolved Hide resolved
server/backend/api/app/schemas/change_user_detail.py Outdated Show resolved Hide resolved
server/backend/api/app/schemas/privilege_details.py Outdated Show resolved Hide resolved
server/backend/api/app/schemas/privilege_details.py Outdated Show resolved Hide resolved
server/backend/api/app/schemas/privilege_details.py Outdated Show resolved Hide resolved
server/backend/api/app/schemas/privilege_details.py Outdated Show resolved Hide resolved
@craigyu craigyu marked this pull request as ready for review September 12, 2024 03:27
@craigyu craigyu marked this pull request as draft September 12, 2024 03:28
@craigyu craigyu marked this pull request as ready for review September 12, 2024 03:59
Copy link
Collaborator

@ianliuwk1019 ianliuwk1019 left a comment

Choose a reason for hiding this comment

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

Thank you so much for lots of docs in functions/classes!!
Looks good to me, just minor comments.

server/backend/api/app/constants.py Show resolved Hide resolved
server/backend/api/app/routers/router_guards.py Outdated Show resolved Hide resolved
server/backend/api/app/routers/router_permission_audit.py Outdated Show resolved Hide resolved
server/backend/api/app/crud/crud_permission_audit.py Outdated Show resolved Hide resolved
server/backend/api/app/crud/crud_permission_audit.py Outdated Show resolved Hide resolved
Copy link

Quality Gate Passed Quality Gate passed for 'nr-forests-access-management_admin'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Collaborator

@ianliuwk1019 ianliuwk1019 left a comment

Choose a reason for hiding this comment

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

Thank you for the big PR!!

@ianliuwk1019 ianliuwk1019 merged commit 06294a7 into main Sep 13, 2024
13 checks passed
@ianliuwk1019 ianliuwk1019 deleted the feat/1537-create-an-api-to-return-audit-information branch September 13, 2024 23:59
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.

Create an api to return audit information
3 participants