Page 2 of 2

Re: retrive error Ice.MemoryLimitException

PostPosted: Thu Dec 06, 2012 12:36 pm
by jmoore
If you have the group id, then you can use adminServicePrx.containedExperimenters(groupID). That returns a list. On each of those, you can call: experimenter.getId().getValue() to get the id.

Cheers,
~Josh

P.S. Sorry for having missed your comment on the 3rd!

Re: retrive error Ice.MemoryLimitException

PostPosted: Thu Dec 06, 2012 1:08 pm
by jiez
thanks a bunch for the help, josh, really quick one.

jiez

Re: retrive error Ice.MemoryLimitException

PostPosted: Fri Dec 07, 2012 2:00 pm
by jiez
A new problem. No data can be retrieved rather than the log in user.

I would like to retrieve all user's data in one shared group as a admin.

here is the summary again,

// connect as admin;
myClient = new client (hostName, portNo);
myEntry = myClient.createSession(userName,passwd);

// how many groups in;
List <Long> allGroupIds = myEntry.getAdminService().getEventContext().memberOfGroups;
for (int n=0; n<allGroupIds.size(); n++)

// experimenter ids in one group;
List <Experimenter> expts =myEntry.getAdminService().containedExperimenters(groupId_);
Iterator <Experimenter> i = expts.iterator();

// obtain one experimenter's data in one project
IContainerPrx proxy = myEntry.getContainerService();
ParametersI param = new ParametersI();
(*) // myEntry.getAdminService().getEventContext().userId;

(**) long userId =lon_userId;
param.exp(omero.rtypes.rlong(userId));
param.noLeaves();


List<IObject> results = proxy.loadContainerHierarchy(Project.class.getName(), new ArrayList<Long>(), param);

Iterator<IObject> i = results.iterator();


The problem is that if the userId at (**) is other than the id got by (*), the Project brings back nothing.

I assume myEntry is specified by log in user, cannot shared with other users.

How can i modify this please?

cheers

Jiez

Re: retrive error Ice.MemoryLimitException

PostPosted: Fri Dec 07, 2012 4:14 pm
by jmoore
Hi Jiez,

I'm not sure exactly what's going wrong in your snippet, though it's likely caused by looking at other groups at the same time. I've updated my gist, perhaps that will help. If you could provide a complete running example (perhaps by forking that gist), it would make it much easier to know what's going wrong.

The output for that change when I run it begins like this:
Code: Select all
The connection is set up and userId is:15**.

groupId is:8**.

Retrieving for user: 203
Retrieving for user: 7
Retrieving for user: 2
Retrieving for user: 5
start retrieving project:public test.
start retrieving dataset:survivin-27.1.05.
   Loaded 0 images in page 1
start retrieving dataset:dataset from project.
   Loaded 0 images in page 1
...
Retrieving for user: 15
Retrieving for user: 3
Retrieving for user: 0
Retrieving for user: 9
start retrieving project:qa.
start retrieving dataset:4772.
   Loaded 1 images in page 1
Retrieving for user: 13
Retrieving for user: 10
start retrieving project:p1.
start retrieving project:x4.



Cheers,
~Josh

Re: retrive error Ice.MemoryLimitException

PostPosted: Fri Dec 07, 2012 5:28 pm
by jiez
thanks Josh.

A little bit weird. I made no changes to previous version but log in to count image numbers in one project with OMEROinsight, and after this, It CAN retrieve other users' data now.

anyway , i'll try your new template .

jiez

Re: retrive error Ice.MemoryLimitException

PostPosted: Fri Dec 07, 2012 5:51 pm
by jmoore
I would assume that's an issue of your default group changing. Perhaps your group wasn't what you expected when testing previously?

Anyway, good to hear that it's working. Let us know if there's anything else you need.

~J.

Re: retrive error Ice.MemoryLimitException

PostPosted: Mon Dec 10, 2012 3:45 pm
by jiez
I read through the permission doc
https://www.openmicroscopy.org/site/support/omero4/sysadmins/server-permissions.html

cannot figure out the admin's roles in manipulating group member's data. what methods are available for admins ?

for example, when I log in as a admin

Code: Select all
// connect as admin;
myClient = new client (hostName, portNo);
myEntry = myClient.createSession(admin,admin_passwd); 
// do stuff of groups, experimenters, projects, datasets;
.........



Then later on, I need to change the role as a specific group member grp_mb_1 to do something ,e.g.,

Code: Select all
ServiceFactoryPrx  myEntry_mb = myClient.createSession(grp_mb_1,grp_mb_1_passwd);
ThumbnailStorePrx store = myEntry_mb.createThumbnailStore();
// doing thumbnails;

...... 


Why changes the role ? I found myEntry (admin) cannot retrieve rp_mb_1 's thumbnails properly, but myEntry_mb does.

So, is there a way to obtain grp_mb_1's password as a admin? We not use LADP accession, but user(passwd) . OR, are there simple methods that allow admin acting as grp_mb_1 temporarily like myEntry_mb.createThumbnailStore()?

thanks.

Re: retrive error Ice.MemoryLimitException

PostPosted: Mon Dec 10, 2012 7:41 pm
by jmoore
Each session is in a specific security context, usually a group. By changing this value, you can view data from a different group. Here is how insight makes the change:

https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java#L1440

Cheers
~Josh

Re: retrive error Ice.MemoryLimitException

PostPosted: Tue Dec 11, 2012 2:00 pm
by jiez
thanks josh. i need some time to digest that.

A quick question,

is method available in Experimenter for password similar to getPassword() like id "Experimenter.getId().getValue()" ?

http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model/Experimenter.html

does not mention them .

jiez

Re: retrive error Ice.MemoryLimitException

PostPosted: Tue Dec 11, 2012 8:56 pm
by jmoore
jiez wrote:is method available in Experimenter for password similar to getPassword() like id "Experimenter.getId().getValue()" ?


Sorry, but the password is not exposed via the API at all. You can only set the password for the current user via IAdmin.changePassword(RString) or for another user via IAdmin.changeUserPassword(string name, RType newPassword). If you are using LDAP, you can't change the passwords via OMERO at all.

Cheers,
~Josh.