[ome-devel] change user id in the API

josh.moore at gmx.de josh.moore at gmx.de
Wed Mar 4 08:46:54 GMT 2009


Matthias Dunda writes:
 > Thanks Josh,
 > 
 > but I don't get it yet... :-(

No problem. I was rushing. Sorry. :)

 > I have
 > 
 > public class TestUserChange {
 >     public static void main(String[] args) throws Exception {
 >         omero.client client = new omero.client("localhost");
 >         ServiceFactoryPrx sf = client.createSession("root","ome");
 > 
...

 > from my understanding I need a new ServiceFactoryPrx from which I
 > can get the appropriate updateService to create for example a new
 > Project and all further substructures (you know what I mean) for a
 > different user.

Correct.

 > In the example above I want to login as root and then switch the
 > user context to the Experimenter e which is loaded with user id
 > 100.
 > 
 > In your example you wrote the comment for user name etc. after
 > creation of the Pricipal p, but p does not provide meaningful
 > methods to me...
 > 

I was forgetting that the Principal object wasn't much used under
RMI. The major change with Blitz/Ice is that Principal is now a
struct, so you can simply fill the fields. I added an example in r3933

https://trac.openmicroscopy.org.uk/omero/browser/trunk/examples/OmeroClients/sudo.java?rev=3933

 > I see Session has a setOwner method, but anyway, how do I get a new
 > ServiceFactory then? :-Q

Ignore this. It's not mutable in the regular case.

Hope that helps.
~J.


More information about the ome-devel mailing list