Another question regarding the use of UserAdmin.

In my user model, I have the classic situation where users can be
members of groups (wow, so exciting). I provide a typed service (let's
just call them MyUser and MyGroup) that is completely based on the OSGi
UserAdmin Service.

Up until now, in order to be able to service a request like this:

  MyGroup[] myGroups = finder.getGroupsForUser( MyUser myUser );

each time that a MyUser was added to a MyGroup, I would update a
property to the User in UserAdmin that would back MyUser, something like
this:

  User osgiUser = (User)userAdmin.getRole( myUser.getId() );
  Dictionary properties = osgiUser.getProperties();
  String groupsString = properties.get( GROUPS_PROP );
  // update groups string, which acts like an index

I would then use the regular search facility provided by UserAdmin, so
like:

  String GROUPS_FILTER = ... // create a filter on the groups index
  Role[] foundGroups = userAdmin.getRoles( GROUPS_FILTER );


This works, but I've never really been happy with it because it seems
really brittle due to potential data synchronization issues. It also
seems like a really back hack, but then again I've never experienced any
problems until now.


Now (as I expected would happen some day) I'm  having issues with this
method, so I'd like to find a better, more permanent solution.


My questions are:

What do people here usually do to solve this problem in an acceptable
way?


Is there anything planned in future versions of the spec to handle
indexing of the UserAdmin service to allow for better searches?


Thank you!
=David


_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to