Problem with the "set_library_permissions" function on bioblend
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
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/c4291f95313abcb1ad91ffe4.... 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/
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/c4291f95313abcb1ad91ffe4.... 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/
In addition, the content of "parser.log" file with and without the modification _With modification_ : galaxy.web.framework ERROR 2014-04-30 14:11:52,222 Uncaught exception in exposed API method: Traceback (most recent call last): File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 199, in decorator rval = func( self, trans, *args, **kwargs) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/webapps/galaxy/api/permissions.py", line 50, in create *item = library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id , 'root_folder_id' : trans.security.encode_id } )* File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/model/__init__.py", line 1960, in to_dict rval[ 'root_folder_id' ] = 'F' + rval[ 'root_folder_id' ] TypeError: cannot concatenate 'str' and 'int' objects _Without modification_ : galaxy.web.framework ERROR 2014-04-30 14:16:56,853 Uncaught exception in exposed API method: Traceback (most recent call last): File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 199, in decorator rval = func( self, trans, *args, **kwargs) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/webapps/galaxy/api/permissions.py", line 50, in create *item = library.to_dict( view='element' )** * File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/model/__init__.py", line 1960, in to_dict rval[ 'root_folder_id' ] = 'F' + rval[ 'root_folder_id' ] TypeError: cannot concatenate 'str' and 'int' objects Kevin MURET Intern at Station Biologique de Roscoff ABiMS platform
Just retried it on a fresh copy of galaxy-dist (the stable branch of galaxy-dist now includes this patch) and it worked fine for me. Can someone else verify? So my best guess is you guys have modified something in the library code - or you applied that patch but to an older version of galaxy?
l = gi.libraries.create_library("testlib") gi.libraries.set_library_permissions( l['id'], access_in=[], modify_in=[], add_in=[], manage_in=[] ) {u'description': u'', u'deleted': False, u'synopsis': u'', u'root_folder_id': u'Ff2db41e1fa331b3e', u'model_class': u'Library', u'id': u'f2db41e1fa331b3e', u'name': u'testlib'}
Sorry I cannot be of more help. -John On Wed, Apr 30, 2014 at 7:26 AM, Kevin Muret <kmuret@sb-roscoff.fr> wrote:
In addition, the content of "parser.log" file with and without the modification
With modification : galaxy.web.framework ERROR 2014-04-30 14:11:52,222 Uncaught exception in exposed API method:
Traceback (most recent call last): File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 199, in decorator rval = func( self, trans, *args, **kwargs) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/webapps/galaxy/api/permissions.py", line 50, in create item = library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id , 'root_folder_id' : trans.security.encode_id } ) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/model/__init__.py", line 1960, in to_dict rval[ 'root_folder_id' ] = 'F' + rval[ 'root_folder_id' ] TypeError: cannot concatenate 'str' and 'int' objects
Without modification : galaxy.web.framework ERROR 2014-04-30 14:16:56,853 Uncaught exception in exposed API method:
Traceback (most recent call last): File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 199, in decorator rval = func( self, trans, *args, **kwargs) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/webapps/galaxy/api/permissions.py", line 50, in create item = library.to_dict( view='element' ) File "/w/galaxy/galaxy4kevin/galaxy-dist/lib/galaxy/model/__init__.py", line 1960, in to_dict rval[ 'root_folder_id' ] = 'F' + rval[ 'root_folder_id' ] TypeError: cannot concatenate 'str' and 'int' objects
Kevin MURET Intern at Station Biologique de Roscoff ABiMS platform
participants (2)
-
John Chilton
-
Kevin Muret