Hi, Thanks, Looks like what I need for both use cases as requested. Strange it didn't turn up in the Web Console plugin I am looking at, perhaps I need to upgrade. Best Regards Ian
On 26 February 2015 at 11:11, Roland Schaer <[email protected]> wrote: > Hi Ian, > > there is an adapter factory [1] that tries to resolve the tenant by > identifier configured with regular expressions via [2]. > > [1] > https://github.com/apache/sling/blob/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java > [2] > http://localhost:4502/system/console/configMgr/org.apache.sling.tenant.internal.TenantProviderImpl > > ./Roland > > On 26 Feb 2015, at 07:56, Ian Boston <[email protected]<mailto:[email protected]>> > wrote: > > Hi, > Does sling support the following ? > I have looked at some running instances and not found adapter factories > that do. > > Tenant tenant = resource.adaptTo(Tenant.class) > > Where tenant is the tenant in which the resource resides or the tenant has > read access to. I guess in highly collaborative environments it could be > more than one Tenant, but lets not go there just yet. > > and > > Tenant tenant = resource.getResourceResolver().adaptTo(Tenant.class) > > Where the tenant in this case the the tenant to which the user that created > the resource resolver belongs. > > If Sling could support these 2 Adapt patterns I think it would greatly > simplify how application code learns about the tenant environment it exists > in. > > If it already does, is there a pointer to where, I could not find it. > > Best Regards > Ian > >
