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(chore): add tenant provision in audit logs #102

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Conversation

Tyagi-Sunny
Copy link
Contributor

add tenant provision in audit logs

BREAKING CHANGE:
add tenant provision in audit logs

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #101

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Intermediate change (work in progress)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Any dependent changes have been merged and published in downstream modules

package.json Outdated
@@ -61,6 +61,7 @@
"@loopback/core": "^5.1.5",
"@loopback/repository": "^6.1.5",
"@loopback/sequelize": "^0.5.4",
"@sourceloop/core": "^11.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

wont this create a cyclic dependency

@@ -59,6 +59,7 @@ export function AuditRepositoryMixin<
entityId: entity.getId(),
actedOn: this.entityClass.modelName,
actionKey: opts.actionKey,
tenantId: user.tenantId,
Copy link
Contributor

Choose a reason for hiding this comment

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

what if the user.tenantId is undefined
then defaultTenantId should be saved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

user.tenantId can never be undefined. as it is mentioned as required in our authentication service. it user didn't provide its values then he/she will not able to login.
there is also one defaultTenantId, but if tenantid can not be NULL then why do we need to mention defaultid here


@tenantGuard()
Copy link
Contributor

Choose a reason for hiding this comment

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

create, update and delete is already handled via mixin and we dont have any read operation in this
do we really need this

Copy link
Contributor Author

@Tyagi-Sunny Tyagi-Sunny Feb 4, 2024

Choose a reason for hiding this comment

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

AuditLogRepository and AuditLog Model of loopback4-audit-log and @sourceloop/audit-service should be same, otherwise they causes error.
image

will test after removing tenatguard from here, if everything works fine, then will remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Provision to get tenant wise logs

BREAKING CHANGE:
Provision to get tenant wise logs

101
Copy link

sonarqubecloud bot commented Feb 5, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

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

See analysis details on SonarCloud

Copy link

@a-ganguly a-ganguly left a comment

Choose a reason for hiding this comment

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

Add tenant provision in audit logs

@a-ganguly a-ganguly merged commit ed83622 into master Feb 7, 2024
5 checks passed
@a-ganguly a-ganguly deleted the gh-101 branch February 7, 2024 06:49
@yeshamavani
Copy link
Contributor

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add tenant provisions in audit logs
3 participants