Page 2 of 2

Re: CommandLineImporter configuration for group

PostPosted: Tue Apr 09, 2019 10:42 am
by derekeh
Josh,
Fantastic !
That works. Many thanks.

I think I may have misunderstood how the securityContext is used in the manipulation of Omero objects.
I had thought that it was implicit within the Gateway and that I could use the sessionID of the Gateway to pass to the ImportConfig.
I see now that the securityContext itself (with a groupID assigned to it) is passed to a DataManagerFacility.saveAndReturnObject and that is what allows me to create/edit datasets/annotations etc in different groups.
I still wouldn't have got to the magic line:
Code: Select all
omero.client omero_client = new omero.client(new String[]{

Didn't see that in the API.

Really appreciate your time spent on this thread.
Regards
Derek

Re: CommandLineImporter configuration for group

PostPosted: Tue Apr 09, 2019 10:57 am
by jmoore
Thanks for the confirmation, Derek.

I've filed https://github.com/ome/omero-blitz/issues/38 for propagating the `config.group` setting where it's needed server-side. Once that's released, you shouldn't need this workaround anymore.

One thing to be careful with my fix is that you are creating two clients. It's conceivable that one could timeout on long-running processes. In fact, I should have suggested closing the first client to prevent confusion:

Code: Select all
    String sessionId = null;
    try {
      c.createSession("USER", "omero");
      sessionId = c.getSessionId();
    } finally {
      c.getSession().detachOnDestroy();
      c.__del__();
    }
    run(sessionId);
  }


If you have any issues, let us know.
~Josh