Page 1 of 1

Changing ownership of data

PostPosted: Fri Feb 05, 2016 4:17 am
by Lachie
Hi All,

I'd like to be able to move data between users in different groups. At the moment I understand the way to do this would be with the CLI command chown, but as I understand it this leaves the data in place and so while the new owner owns the data, they can't see it.

I figured the next step would be to use chgrp to move the data to the new owners group but this is where I run into trouble. Despite being an administrator I can't seem to complete this move (I get the error "Current user is not member of group: " error). I also tried to change myself into that group (using omero sessions group ) but to no avail.

Is there something I'm missing or am I going about this in entirely the wrong way?

Thanks,
-Lachie

Re: Changing ownership of data

PostPosted: Fri Feb 05, 2016 9:05 am
by cblackburn
Hi Lachie,

I'd like to try to reproduce the problem if possible, so could you describe the scenario you have in a little more detail (anonymising any names of course)? What are the permissions of the two groups, which users are in which groups, etc.? And what is the cli command that fails? Also, could you let us know what version of OMERO you are using?

Cheers,

Colin

Re: Changing ownership of data

PostPosted: Thu Feb 18, 2016 4:28 am
by Lachie
Hi Colin,

Basically what I have gone through:
1) Important an image (Image:823) into my user account, in my group (permissions private (rw------))
2) Changed ownership of data to a user in another group (user:157, grp:155) with the same permissions (private):

Code: Select all
bin/omero chown 157 Image:823
Using session 9bae3385-dbce-4f32-bd88-ae86de4dfec2 (myusername@localhost:4064). Idle timeout: 10 min. Current group: grp_my_group
omero.cmd.Chown2 Image 823... ok


3) So my understanding goes that user 157 now owns that data, but it remains in my group so she can't access it. Trying to move the data to her group:
Code: Select all
bin/omero chgrp 155 Image:823
Using session 9bae3385-dbce-4f32-bd88-ae86de4dfec2 (myusername@localhost:4064). Idle timeout: 10 min. Current group: grp_my_group
Current user is not member of group: 155


Essentially I just need to know how to move a dataset from one user to another assuming that at some point someone is going to accidentally import data using someone else's account.

Any insight would be greatly appreciated.

Thanks,
-Lachie

Re: Changing ownership of data

PostPosted: Thu Feb 18, 2016 10:35 am
by wmoore
Hi Lachie,

We currently check whether the chgrp is moving the data to a group that the user is not a member of. This is to prevent a user from moving their own data to a group they're not in, because their data would then be "lost" (they wouldn't be able to access it).
However, this check doesn't make sense when you are moving another user's data (BUG).

The easiest workaround is to simply add yourself to the target group (155).
Alternatively, you could comment out the offending block of code in:
Code: Select all
<SERVER>/lib/python/omero/plugins/chgrp.py


Code: Select all
        # Check session owner is member of the target group
        uid = client.sf.getAdminService().getEventContext().userId
        ids = [x.child.id.val for x in group.copyGroupExperimenterMap()]
        if uid not in ids:
            self.ctx.die(197, "Current user is not member of group: %s" %
                         group.id.val)


If you comment out these lines then you will be able to follow your workflow as before.
We have created a ticket to address this BUG, https://trac.openmicroscopy.org/ome/ticket/13159 but hopefully one of those 2 workarounds will work for you in the meantime.

Regards,

Will.

Re: Changing ownership of data

PostPosted: Thu Feb 18, 2016 10:17 pm
by Lachie
Hi Will,

Thanks for the response, glad to know I was going about things in the right way.

Your work around works for me. I'm the only one that's going to be using the command line interface anyway so I suspect this is going to have no impact on users.

Thanks again,
-Lachie