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

Audit logging ignores multitenant mode #152

Open
martinvlk opened this issue Jun 15, 2017 · 5 comments
Open

Audit logging ignores multitenant mode #152

martinvlk opened this issue Jun 15, 2017 · 5 comments

Comments

@martinvlk
Copy link

Hi, we are implementing an application which uses the GORM multitenancy in DATABASE mode, e.g.

grails:
  gorm:
    multiTenancy:
      mode: DATABASE

However, the audit-logging plugin ignores the resolved tenant data source and always writes to the DEFAULT data source.

Could you add support for multitenancy?

@robertoschwald
Copy link
Contributor

robertoschwald commented Jun 15, 2017 via email

@martinvlk
Copy link
Author

Ok, looking at it... it seems that the AuditLogListener is only reacting to events from the DEFAULT data source. Whatever happens in other data sources related to different tenants is completely ignored.

Could you point me in the right direction for fixing this?

@martinvlk
Copy link
Author

Aha, this is related to #57 - it says "not possible"......

@robertoschwald
Copy link
Contributor

In the AuditLoggingGrailsPlugin descriptor, we register an AuditLogListener per DataSource.
So you need to enable multi tenancy in the audit-test sub-project's AuditTrail domain class, as you write tests for this feature, right? ;-)

In the AuditLogListener, you need to figure out if the Domain object is tenant enabled and store the AuditTrail using this tennant id. Maybe 11.2.3 in Gorm 6.1 docs can be a hint.

Please note that the plugin must stay ORM agnostic. So you need to find an ORM independent way. Thus, don't deal with Hibernate / Mongo / etc. classes directly.

Haven't played around with tenancy yet, so the info above is just a rough guess.

@xaw-roz
Copy link

xaw-roz commented Jul 23, 2019

Do we have support for multitenancy now?

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

No branches or pull requests

3 participants