We're Hiring!

CommandLineImporter configuration for group

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: CommandLineImporter configuration for group

Postby derekeh » Tue Apr 09, 2019 10:42 am

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
derekeh
 
Posts: 31
Joined: Mon Feb 12, 2018 12:00 pm

Re: CommandLineImporter configuration for group

Postby jmoore » Tue Apr 09, 2019 10:57 am

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest