No JCR event when using the usermanager
I try to implement an audit mechanism and part of it is to track the changes that happen in the user and group sections. However when I use the REST interface of the usermanager, I don't receive any events when a user is added below /system/userManager/user When I add a node there "by hand" I get the notifications Any obvious reason for that? Thanks, Markus
Re: No JCR event when using the usermanager
On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko wrote: > I try to implement an audit mechanism and part of it is to track the > changes that happen in the user and group sections. > However when I use the REST interface of the usermanager, I don't > receive any events when a user is added below /system/userManager/user > > When I add a node there "by hand" I get the notifications > > Any obvious reason for that? Just guessing, but I think the user nodes are added to the 'security' workspace, but the event listeners are only listening to events from the 'default' workspace. You could try registering a JCR event listener for the security workspace by repository.login([credentials], "security").getObservationManager().addEventListener(...); -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 Quando omni flunkus moritatus!
Re: No JCR event when using the usermanager
Hi Vidar, that also doesn't work. Checking the CreateUserServlet I see that it is using the default workspace. Any other ideas? Thanks, Markus On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: > On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko > wrote: >> I try to implement an audit mechanism and part of it is to track the >> changes that happen in the user and group sections. >> However when I use the REST interface of the usermanager, I don't >> receive any events when a user is added below /system/userManager/user >> >> When I add a node there "by hand" I get the notifications >> >> Any obvious reason for that? > > Just guessing, but I think the user nodes are added to the 'security' > workspace, but the event listeners are only listening to events from > the 'default' workspace. > > You could try registering a JCR event listener for the security > workspace by repository.login([credentials], > "security").getObservationManager().addEventListener(...); > > -- > Vidar S. Ramdal - http://www.idium.no > Sommerrogata 13-15, N-0255 Oslo, Norway > + 47 22 00 84 00 > Quando omni flunkus moritatus! >
Re: No JCR event when using the usermanager
>> On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko >> wrote: >>> I try to implement an audit mechanism and part of it is to track the >>> changes that happen in the user and group sections. >>> However when I use the REST interface of the usermanager, I don't >>> receive any events when a user is added below /system/userManager/user >>> >>> When I add a node there "by hand" I get the notifications >>> >>> Any obvious reason for that? > On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: >> Just guessing, but I think the user nodes are added to the 'security' >> workspace, but the event listeners are only listening to events from >> the 'default' workspace. >> >> You could try registering a JCR event listener for the security >> workspace by repository.login([credentials], >> "security").getObservationManager().addEventListener(...); On Thu, Jan 27, 2011 at 4:59 PM, Markus Joschko wrote: > Hi Vidar, > that also doesn't work. > Checking the CreateUserServlet I see that it is using the default workspace. Hmm, yes, the CreateUserServlet uses a session for the default workspace to get the UserManager, which in turn is used to create the user. But I'm pretty sure that Jackrabbit internally stores users in the security workspace. Maybe you could post the code of your EventListener, and of ObservationManager.addEventListener call? -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 Quando omni flunkus moritatus!
Re: No JCR event when using the usermanager
Hi, Vidar is right. In Jackrabbit 1 users used to be stored in the security workspace. In Jackrabbit 2 this has been made a bit more pluggable, but IIRC users are still stored in the security workspace. IIRC the session to access the security workspace is encapsulated in the UserManager. Regards Felix Am Donnerstag, den 27.01.2011, 19:05 + schrieb Vidar Ramdal: > >> On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko > >> wrote: > >>> I try to implement an audit mechanism and part of it is to track the > >>> changes that happen in the user and group sections. > >>> However when I use the REST interface of the usermanager, I don't > >>> receive any events when a user is added below /system/userManager/user > >>> > >>> When I add a node there "by hand" I get the notifications > >>> > >>> Any obvious reason for that? > > > On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: > >> Just guessing, but I think the user nodes are added to the 'security' > >> workspace, but the event listeners are only listening to events from > >> the 'default' workspace. > >> > >> You could try registering a JCR event listener for the security > >> workspace by repository.login([credentials], > >> "security").getObservationManager().addEventListener(...); > > On Thu, Jan 27, 2011 at 4:59 PM, Markus Joschko > wrote: > > Hi Vidar, > > that also doesn't work. > > Checking the CreateUserServlet I see that it is using the default workspace. > > Hmm, yes, the CreateUserServlet uses a session for the default > workspace to get the UserManager, which in turn is used to create the > user. > But I'm pretty sure that Jackrabbit internally stores users in the > security workspace. > > Maybe you could post the code of your EventListener, and of > ObservationManager.addEventListener call? > >
Re: No JCR event when using the usermanager
On Thu, Jan 27, 2011 at 10:29 PM, Felix Meschberger wrote: > Hi, > > Vidar is right. In Jackrabbit 1 users used to be stored in the security > workspace. In Jackrabbit 2 this has been made a bit more pluggable, but > IIRC users are still stored in the security workspace. > > IIRC the session to access the security workspace is encapsulated in the > UserManager. Regardless of where users are actually stored by Jackrabbit, perhaps it would make sense to have CreateUserServlet fire an OSGi event (like org/apache/sling/api/resource/Resource/ADDED) when adding a user? The same would obviously apply to the other servlets under o.a.s.jackrabbit.usermanager.impl.post. > Am Donnerstag, den 27.01.2011, 19:05 + schrieb Vidar Ramdal: >> >> On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko >> >> wrote: >> >>> I try to implement an audit mechanism and part of it is to track the >> >>> changes that happen in the user and group sections. >> >>> However when I use the REST interface of the usermanager, I don't >> >>> receive any events when a user is added below /system/userManager/user >> >>> >> >>> When I add a node there "by hand" I get the notifications >> >>> >> >>> Any obvious reason for that? >> >> > On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: >> >> Just guessing, but I think the user nodes are added to the 'security' >> >> workspace, but the event listeners are only listening to events from >> >> the 'default' workspace. >> >> >> >> You could try registering a JCR event listener for the security >> >> workspace by repository.login([credentials], >> >> "security").getObservationManager().addEventListener(...); >> >> On Thu, Jan 27, 2011 at 4:59 PM, Markus Joschko >> wrote: >> > Hi Vidar, >> > that also doesn't work. >> > Checking the CreateUserServlet I see that it is using the default >> > workspace. >> >> Hmm, yes, the CreateUserServlet uses a session for the default >> workspace to get the UserManager, which in turn is used to create the >> user. >> But I'm pretty sure that Jackrabbit internally stores users in the >> security workspace. >> >> Maybe you could post the code of your EventListener, and of >> ObservationManager.addEventListener call? >> >> > > > -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 Quando omni flunkus moritatus!
Re: No JCR event when using the usermanager
Hi, Am Donnerstag, den 27.01.2011, 23:37 + schrieb Vidar Ramdal: > On Thu, Jan 27, 2011 at 10:29 PM, Felix Meschberger > wrote: > > Hi, > > > > Vidar is right. In Jackrabbit 1 users used to be stored in the security > > workspace. In Jackrabbit 2 this has been made a bit more pluggable, but > > IIRC users are still stored in the security workspace. > > > > IIRC the session to access the security workspace is encapsulated in the > > UserManager. > > Regardless of where users are actually stored by Jackrabbit, perhaps > it would make sense to have CreateUserServlet fire an OSGi event (like > org/apache/sling/api/resource/Resource/ADDED) when adding a user? > The same would obviously apply to the other servlets under > o.a.s.jackrabbit.usermanager.impl.post. Definitely, I agree, that JCR level events are probably not appropriate for handling User Management situations because it is the very goal of the user manager to abstract and hide the actual location of the users. But then: Not all user management actions go through the servlets and hence the events would be incomplete. I think the UserManager itself should actually fire events... Regards Felix > > > Am Donnerstag, den 27.01.2011, 19:05 + schrieb Vidar Ramdal: > >> >> On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko > >> >> wrote: > >> >>> I try to implement an audit mechanism and part of it is to track the > >> >>> changes that happen in the user and group sections. > >> >>> However when I use the REST interface of the usermanager, I don't > >> >>> receive any events when a user is added below /system/userManager/user > >> >>> > >> >>> When I add a node there "by hand" I get the notifications > >> >>> > >> >>> Any obvious reason for that? > >> > >> > On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: > >> >> Just guessing, but I think the user nodes are added to the 'security' > >> >> workspace, but the event listeners are only listening to events from > >> >> the 'default' workspace. > >> >> > >> >> You could try registering a JCR event listener for the security > >> >> workspace by repository.login([credentials], > >> >> "security").getObservationManager().addEventListener(...); > >> > >> On Thu, Jan 27, 2011 at 4:59 PM, Markus Joschko > >> wrote: > >> > Hi Vidar, > >> > that also doesn't work. > >> > Checking the CreateUserServlet I see that it is using the default > >> > workspace. > >> > >> Hmm, yes, the CreateUserServlet uses a session for the default > >> workspace to get the UserManager, which in turn is used to create the > >> user. > >> But I'm pretty sure that Jackrabbit internally stores users in the > >> security workspace. > >> > >> Maybe you could post the code of your EventListener, and of > >> ObservationManager.addEventListener call? > >> > >> > > > > > > > > >
Re: No JCR event when using the usermanager
>> > Vidar is right. In Jackrabbit 1 users used to be stored in the security >> > workspace. In Jackrabbit 2 this has been made a bit more pluggable, but >> > IIRC users are still stored in the security workspace. >> > >> > IIRC the session to access the security workspace is encapsulated in the >> > UserManager. I can't see that. The UserManager is retrieved from the session established in the CreateUserServlet and operates on that. There doesn't seem to be a call to a security workspace. However I find that the users are actually stored in a /rep:system/rep:userManager path which is mapped to /system/userManager. However I don't get any results either when I listen to this path. >> >> Regardless of where users are actually stored by Jackrabbit, perhaps >> it would make sense to have CreateUserServlet fire an OSGi event (like >> org/apache/sling/api/resource/Resource/ADDED) when adding a user? >> The same would obviously apply to the other servlets under >> o.a.s.jackrabbit.usermanager.impl.post. > > Definitely, I agree, that JCR level events are probably not appropriate > for handling User Management situations because it is the very goal of > the user manager to abstract and hide the actual location of the users. > I liked the idea of using JCR events because it unifies the event handling. And in addition I am more interested in property changes (who has added a user when to which group) then the pure node creations. Something that is covered already by the JCR events. > But then: Not all user management actions go through the servlets and > hence the events would be incomplete. I think the UserManager itself > should actually fire events... Isn't the userManager part of Jackrabbit? Which kind of events will it then fire? Regards, Markus >> > Am Donnerstag, den 27.01.2011, 19:05 + schrieb Vidar Ramdal: >> >> >> On Thu, Jan 27, 2011 at 9:56 AM, Markus Joschko >> >> >> wrote: >> >> >>> I try to implement an audit mechanism and part of it is to track the >> >> >>> changes that happen in the user and group sections. >> >> >>> However when I use the REST interface of the usermanager, I don't >> >> >>> receive any events when a user is added below /system/userManager/user >> >> >>> >> >> >>> When I add a node there "by hand" I get the notifications >> >> >>> >> >> >>> Any obvious reason for that? >> >> >> >> > On Thu, Jan 27, 2011 at 10:06 AM, Vidar Ramdal wrote: >> >> >> Just guessing, but I think the user nodes are added to the 'security' >> >> >> workspace, but the event listeners are only listening to events from >> >> >> the 'default' workspace. >> >> >> >> >> >> You could try registering a JCR event listener for the security >> >> >> workspace by repository.login([credentials], >> >> >> "security").getObservationManager().addEventListener(...); >> >> >> >> On Thu, Jan 27, 2011 at 4:59 PM, Markus Joschko >> >> wrote: >> >> > Hi Vidar, >> >> > that also doesn't work. >> >> > Checking the CreateUserServlet I see that it is using the default >> >> > workspace. >> >> >> >> Hmm, yes, the CreateUserServlet uses a session for the default >> >> workspace to get the UserManager, which in turn is used to create the >> >> user. >> >> But I'm pretty sure that Jackrabbit internally stores users in the >> >> security workspace. >> >> >> >> Maybe you could post the code of your EventListener, and of >> >> ObservationManager.addEventListener call? >> >> >> >> >> > >> > >> > >> >> >> > > >
Re: No JCR event when using the usermanager
> Maybe you could post the code of your EventListener, and of > ObservationManager.addEventListener call? It's pretty similar to the event listener in the slingbucks examle. As I constantly try different paths and workspaces there isn't the ONE configuration. But registering looks like: final String[] types = null; final boolean isDeep = true; final boolean noLocal = true; String path = "/system/userManager/"; //also tried "/rep:security/rep:authorizables/" and "/rep:system/rep:userManager/" session.getWorkspace().getObservationManager().addEventListener(userMgmtListener, listenOnEvents, path, isDeep, null, types, noLocal); log.info("Observing property changes to {} nodes under {}", types==null?"All":Arrays.asList(types), path); In addition I use the same session to add a second eventListener that listens to events int the "/content" branch. But that shouldn't be a problem, or? The event listener itself is just dumping a log message without any checks. Regards, Markus
Re: No JCR event when using the usermanager
On 27.01.11 22:29, "Felix Meschberger" wrote: >Vidar is right. In Jackrabbit 1 users used to be stored in the security >workspace. In Jackrabbit 2 this has been made a bit more pluggable, but >IIRC users are still stored in the security workspace. I think the default in Jackrabbit 2 is to store users in the default workspace (using the UserPerWorkspaceUserManager). Regards, Alex -- Alexander Klimetschek Developer // Adobe (Day) // Berlin - Basel
Re: No JCR event when using the usermanager
On Fri, Jan 28, 2011 at 11:08 AM, Markus Joschko wrote: >> Maybe you could post the code of your EventListener, and of >> ObservationManager.addEventListener call? > > It's pretty similar to the event listener in the slingbucks examle. As > I constantly try different paths and workspaces there isn't the ONE > configuration. But registering looks like: > > final String[] types = null; > final boolean isDeep = true; > final boolean noLocal = true; > String path = "/system/userManager/"; This will most certainly NOT work. The /system/userManager path does not refer to a JCR node, but only the userManager servlets in the Sling resource tree. So registering a JCR event listener for that path will have no effect. > //also tried "/rep:security/rep:authorizables/" and > "/rep:system/rep:userManager/" > > session.getWorkspace().getObservationManager().addEventListener(userMgmtListener, > listenOnEvents, path, isDeep, null, types, noLocal); > log.info("Observing property changes to {} nodes under {}", > types==null?"All":Arrays.asList(types), path); > > In addition I use the same session to add a second eventListener that > listens to events int the "/content" branch. But that shouldn't be a > problem, or? I don't think so, as long as you are not re-registering the same eventListener twice. > The event listener itself is just dumping a log message without any checks. I'm not sure how users are stored in Jackrabbit 2 (which you are probably running), but you should see if you can find the nodes describing user accounts, by using some JCR explorer. -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 Quando omni flunkus moritatus!
Re: No JCR event when using the usermanager
On Fri, Jan 28, 2011 at 11:58 AM, Vidar Ramdal wrote: > On Fri, Jan 28, 2011 at 11:08 AM, Markus Joschko > wrote: >>> Maybe you could post the code of your EventListener, and of >>> ObservationManager.addEventListener call? >> >> It's pretty similar to the event listener in the slingbucks examle. As >> I constantly try different paths and workspaces there isn't the ONE >> configuration. But registering looks like: >> >> final String[] types = null; >> final boolean isDeep = true; >> final boolean noLocal = true; >> String path = "/system/userManager/"; > > This will most certainly NOT work. The /system/userManager path does > not refer to a JCR node, but only the userManager servlets in the > Sling resource tree. So registering a JCR event listener for that path > will have no effect. That's the reason why I also tried paths I found in the code ("/rep:security/rep:authorizables/", "/rep:system/rep:userManager/"). However even listening to "/" does not reveal any events when registering the user. Setting acls and content modification trigger events. > I'm not sure how users are stored in Jackrabbit 2 (which you are > probably running), but you should see if you can find the nodes > describing user accounts, by using some JCR explorer. BTW, which JCR explorer are you using? I rely on the .explorer but that has it's limitations. Regards, Markus
Re: No JCR event when using the usermanager
I finally found the answer: The users are indeed stored in the security workspace below /rep:security/rep:authorizables/ I still can't find where the usermanager is writing anything to a workspace other then the default one (I am currently checking out jackrabbit to make sure I look at the version that is used in sling...) In also tried the eclipse plugin from day and it works fine except that I can't see/edit values of properties. Is this a known limitation? Regards, Markus
Re: No JCR event when using the usermanager
Hi, Am Montag, den 31.01.2011, 15:46 + schrieb Markus Joschko: > I finally found the answer: > The users are indeed stored in the security workspace below > /rep:security/rep:authorizables/ > > I still can't find where the usermanager is writing anything to a > workspace other then the default one (I am currently checking out > jackrabbit to make sure I look at the version that is used in > sling...) > > In also tried the eclipse plugin from day and it works fine except > that I can't see/edit values of properties. Is this a known > limitation? We are trying to get out a new version which should be able to edit properties. We are still hammering out licensing, though ... In the meantime, you can go to terrible route or deleting the property and adding it again with a new value. Or you can go for the Sling "Explorer" from the download page. Regards Felix