0

I have a domain class lets say

class ListItem {
  Long tenantId
}

I want to create a namedquery like such

active {
   Long currentTenantId = ?????????;
   or {             
      isNull('tenantId')
      eq ('tenantId', currentTenantId);
  }
}

In otherwords I want there to be ListItem records what everyone can access and listItem records ONLY the tenant can access.

Browsing the source of the plugin I cannot see how I can find out the current tenant without adding a service ref.

Is this possible?

EDIT: The intention is that currentTentantId is not passed as a parameter. Maybe I am being idealistic.

Scott Warren
  • 1,581
  • 1
  • 17
  • 30

1 Answers1

0

Like this?

active { Long currentTenantId ->
   or {             
      isNull 'tenantId'
      eq 'tenantId', currentTenantId
  }
}
Victor Sergienko
  • 13,115
  • 3
  • 57
  • 91