Hi Pieter, glad to see that features is actually used :) Do you mind to add your example to the wiki? Otherwise I can also add it if you like. Thanks, Bjoern
Ok, just answering my own question ;) I found a solution, here it goes (also attached):
import logging
log = logging.getLogger( __name__ )
defrestrict_prims_metabolomics( context, tool ):
"""
This tool filter will hide MsClust for non-metabolomics users. This can be
enabled by adding the following to the
``app:main`` section of ``universe_wsgi.ini``::
tool_filters = primsfilters:restrict_prims_metabolomics
"""
# for debugging: import pydevd;pydevd.settrace("L0136815.wurnet.nl")
user = context.trans.user
metabolomics_tools = ["MsClust","textutil","filter" ]
if tool.namein metabolomics_tools:
# logging.warn( 'FILTER MATCHED: %s' %(tool.name))
for user_role in user.roles:
if user_role.role.name == "PRIMS_METABOLOMICS":
returnTrue
# not found to have the role, return false:
returnFalse
else:
# return true for any other tool
returnTrue
From: galaxy-dev-bounces@lists.bx.psu.edu [mailto:galaxy-dev-bounces@lists.bx.psu.edu] On Behalf Of Lukasse, Pieter Sent: donderdag 30 januari 2014 14:25 To: galaxy-dev@lists.bx.psu.edu Subject: [galaxy-dev] Toolbox filtering question
Hi,
I would like specify a filter based on a role. Does someone know how to do this? I already have an example on how to do this based on user id (found athttps://wiki.galaxyproject.org/UserDefinedToolboxFilters#For_Administrators) but now I would like to filter out menu items in case users don’t have a specific role.
Thanks and regards,
Pieter Lukasse
Wageningen UR, Plant Research International
Departments of Bioscience and Bioinformatics
Wageningen Campus, Building 107, Droevendaalsesteeg 1, 6708 PB, Wageningen, the Netherlands
+31-317481122; skype: pieter.lukasse.wur
___________________________________________________________ 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/