Page 1 of 1

Download permission for images

PostPosted: Mon Jun 04, 2018 12:55 am
by evenhuis
Hi,

I've written (poorly) a python script to download files from out OMERO server to a local machine. The main part of the code is:
Code: Select all
    # dowload the files
    for orig in img.getImportedImageFiles():
        name,ext = os.path.splitext(orig.getName())
        file_path = os.path.join( reldir, new_name+ext)
        print name, orig.getId(), orig.canDownload()

        if( not os.path.exists( file_path)  ):
            with open(str(file_path), 'w') as f:
                for chunk in orig.getFileInChunks():
                    f.write(chunk)


When I code runs for some files I get an error
Code: Select all
    serverExceptionClass = ome.conditions.SecurityViolation
    message = Download is restricted for ome.model.core.OriginalFile:Id_5719


When I check 'canDownload' I don't have permission to do this (even though I uploaded and own file and the rest of the files from the import I can download).

It appears to be occurring only for images that have a fileset. For the original files sometimes I have permission for one of two file but not the other. Sometimes I don't have permission for both. In OMERO.web the option to download the original file doesn't appear.

However, I repeatedly execute the script I will sometimes let me download the file and eventually all the files are downloaded. (I tried to upload the Blitz log parts but I can't seem to attach .log to .txt files.)

I have had a look though the python API bindings and I can't find anything to change the download status of the image. How can change permission of a file?

I tried changing the owner on through the command line tool but got his cryptic error:
Code: Select all
OMERO.server-5.4.1-ice36-b75/bin/omero chown User:119898 Image:1130 --dry-run
Using session 6f981225-3550-47da-b226-d3a5bea42bec (119898@localhost:4064). Idle timeout: 10 min. Current group: default
omero.cmd.Chown2 Image:1130 failed: 'graph-fail'
failed: may not give Image[1130] while WellSample[81] remains


Cheers,

Chris

Re: Download permission for images

PostPosted: Mon Jun 04, 2018 1:14 am
by evenhuis
Hi,

a quick update. I following up the error from the chown commandline. It turns out the files were part of plate as well from when I was testing the 'Dataset to Plate..." script.

After deleting the plate the permissions for download are all good now and the script runs without a hitch.

Cheers,

Chris

Re: Download permission for images

PostPosted: Mon Jun 04, 2018 10:59 am
by jmoore
Ah, thanks for letting us know, Chris.

Yes, the Dataset_to_Plate script can be useful but it changes the assumptions of the server which, for example, disables downloading an entire plate. The variably behavior though sounds like something we should look into. I've filed https://trello.com/c/BbClypZf/422-downloadtoplate-impacts-download-permissions.

Again, thanks for the heads-up.
~Josh

Re: Download permission for images

PostPosted: Fri Jun 08, 2018 5:34 am
by evenhuis
Hi Josh,

thanks for that. I still haven't quite got my ahead around how multiply linked objects work in Omero yet.

Thanks,

Chris