We're Hiring!

Download permission for images

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.

Download permission for images

Postby evenhuis » Mon Jun 04, 2018 12:55 am

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
Attachments
Screen Shot 2018-06-04 at 10.37.38 am.png
attachment error
\
Screen Shot 2018-06-04 at 10.37.38 am.png (13.39 KiB) Viewed 1248 times
evenhuis
 
Posts: 61
Joined: Tue Jan 30, 2018 4:47 am

Re: Download permission for images

Postby evenhuis » Mon Jun 04, 2018 1:14 am

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
Attachments
Screen Shot 2018-06-04 at 11.07.47 am.png
plate and image
Screen Shot 2018-06-04 at 11.07.47 am.png (77.1 KiB) Viewed 1245 times
evenhuis
 
Posts: 61
Joined: Tue Jan 30, 2018 4:47 am

Re: Download permission for images

Postby jmoore » Mon Jun 04, 2018 10:59 am

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

Re: Download permission for images

Postby evenhuis » Fri Jun 08, 2018 5:34 am

Hi Josh,

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

Thanks,

Chris
evenhuis
 
Posts: 61
Joined: Tue Jan 30, 2018 4:47 am


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests