The focus seems to be around providing a service user.
Wouldn't it be preferable to have a system where the bundle defined the 
permissions it requires and then automatically associate an already existing 
system user? 


-----Original Message-----
From: Robert Munteanu [mailto:romb...@apache.org] 
Sent: Monday, November 07, 2016 7:27 AM
To: users@sling.apache.org
Subject: Re: Creating a service user for your own bundle

On Mon, 2016-11-07 at 12:06 +0100, Bertrand Delacretaz wrote:
> On Mon, Nov 7, 2016 at 12:01 PM, Carsten Ziegeler <cziegeler@apache.o
> rg> wrote:
> > Bertrand Delacretaz wrote
> > > ... That's a nice model but IIUC Carsten earlier in this thread 
> > > OSGi capabilities cannot be created at runtime so that won't work 
> > > for service users or access rights.
> > 
> > I just had the crazy idea that we could generate them at runtime by 
> > creating an artifical bundle providing the capabilities. When the 
> > capabilities change, that bundle could be updated....
> 
> I like crazy ideas in general, but service users might appear later 
> during startup, at a time where bundles that need them are already 
> started so not sure if the dynamics would work.
> 
> If we want to keep the usual dynamics of OSGi, the service model is 
> probably better - IIRC we are already using somewhere fake services 
> with properties that act like capabilities, something like depending 
> on a ServiceUserPresent(target="my-service-user") service. I forgot 
> where that is.

We do this for the adapter factories

https://github.com/apache/sling/blob/4df9ab2d6592422889c71fa13afd453a10
a5a626/bundles/extensions/adapter/src/main/java/org/apache/sling/adapte
r/Adaption.java

Robert

Reply via email to