Hi John,

I tried what you suggested:

#!/usr/bin/env python
import os, sys
from bioblend.galaxy import GalaxyInstance

url="http://#####"
key="#######"

def main():
    gi = GalaxyInstance(url=url, key=key)
    l = gi.libraries.create_library("testlib")
    print l['id'] # ok
    gi.libraries.set_library_permissions( l['id'], access_in=[], modify_in=[], add_in=[], manage_in=[])

if __name__ == '__main__':
    main()


I have the same error message :

Traceback (most recent call last):
  File "./test.py", line 17, in <module>
    main()
  File "./test.py", line 14, in main
    gi.libraries.set_library_permissions( l['id'], access_in=[], modify_in=[], add_in=[], manage_in=[])
  File "build/bdist.linux-x86_64/egg/bioblend/galaxy/libraries/__init__.py", line 307, in set_library_permissions
   
  File "build/bdist.linux-x86_64/egg/bioblend/galaxy/client.py", line 71, in _post
  File "build/bdist.linux-x86_64/egg/bioblend/galaxyclient.py", line 94, in make_post_request
bioblend.galaxy.client.ConnectionError: Unexpected response from galaxy: 500: <html>
  <head><title>Internal Server Error</title></head>
  <body>
    <h1>Internal Server Error</h1>
    <p>The server has either erred or is incapable of performing
the requested operation.

<br/>
<!--  --></p>
    <hr noshade>
    <div align="right">WSGI Server</div>
  </body>
</html>


I never success running the allocation of permissions.


Thank you for your help,

Kevin MURET
Intern at Station Biologique de Roscoff
ABiMS platform


Le 17/04/2014 21:32, John Chilton a écrit :
This API controller broke with the latest release from earlier this
week - I have since fixed this in galaxy-central and opened a pull
request to have it fixed in the stable branch. Otherwise I think it
was worked for quite some time. The bioblend commands should be
something like this...

gi = galaxy.GalaxyInstance(url="<url>", key="<key>")
l = gi.libraries.create_library("testlib")
gi.libraries.set_library_permissions( l['id'], access_in=['<role id>'] ) # Require a role id to access get from /api/roles
gi.libraries.set_library_permissions( l['id'], access_in=[], modify_in=[], add_in=[], manage_in=[] ) # reset all permissions
If you have a very new Galaxy, please apply this patch -
https://bitbucket.org/galaxy/galaxy-central/commits/c4291f95313abcb1ad91ffe4faaa2c30b05149dc.
Otherwise can you try using the commands as shown above - lists of
role ids. If that doesn't work there should be some stack traces in
the galaxy log to help diagnose the problem. Please feel free to
follow up with these.

Hope this helps - let me know if there are still problems.

-John

On Tue, Apr 15, 2014 at 2:17 AM, Kevin Muret <kmuret@sb-roscoff.fr> wrote:
Hello to all,

In recent days, I try to do the "set_library_permissions ()" bioblend's
function working.

I tried the following syntaxes, and it was unsuccessful. Anybody know how to
use it? Or otherwise, how would it be possible to modify user access to
libraries (or contents)?

----------------------------------------------

Bonjour à tous,

Depuis quelques jours, je tente de faire fonctionner la fonction
"set_library_permissions()".

J'ai tenté les syntaxes suivantes, et ce fût sans succès. Quelqu'un
saurait-il comment l'utiliser ? Ou comment serait-il possible de modifier
les accès utilisateurs d'une autre manière ?

----------------------------------------------

"instance" is opened with an admin API key.

1 -->  print
instance.libraries.set_library_permissions(library_id="417e33144b294c21",
access_in=None, modify_in=None, add_in=None, manage_in=None)

Traceback (most recent call last):
  File "Workflow_Lib/work_test.py", line 76, in <module>
    main()
  File "Workflow_Lib/work_test.py", line 39, in main
    print
instance.libraries.set_library_permissions(library_id="417e33144b294c21",
access_in=None, modify_in=None, add_in=None, manage_in=None)
  File
"/home/gcc2013/lib/bioblend/lib/python2.7/site-packages/bioblend-0.4.3_dev-py2.7.egg/bioblend/galaxy/libraries/__init__.py",
line 308, in set_library_permissions
    return Client._post(self, payload, url=url)
  File
"/home/gcc2013/lib/bioblend/lib/python2.7/site-packages/bioblend-0.4.3_dev-py2.7.egg/bioblend/galaxy/client.py",
line 181, in _post
    r = self.gi.make_post_request(url, payload=payload,
files_attached=files_attached)
  File
"/home/gcc2013/lib/bioblend/lib/python2.7/site-packages/bioblend-0.4.3_dev-py2.7.egg/bioblend/galaxyclient.py",
line 99, in make_post_request
    r.status_code, body=r.text)     # @see self.body for HTTP response body
bioblend.galaxy.client.ConnectionError: Unexpected response from galaxy:
500: <html>
  <head><title>Internal Server Error</title></head>
  <body>
    <h1>Internal Server Error</h1>
    <p>The server has either erred or is incapable of performing
the requested operation.

<br/>
<!--  --></p>
    <hr noshade>
    <div align="right">WSGI Server</div>
  </body>
</html>

2 --> print
instance.libraries.set_library_permissions(library_id="417e33144b294c21",
access_in=[admin_id], modify_in=[admin_id], add_in=[admin_id],
manage_in=[admin_id])

3 --> Moreover, are we supposed to view the content of this page?
http://localhost:8080/api/libraries/417e33144b294c21/permissions

----------------------------------------------

Thank you in advance to the community for your help,

Kevin MURET
Intern at Station Biologique de Roscoff
ABiMS platform


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/