Ok, just answering my own question ;) I found a solution, here it goes (also attached): import logging log = logging.getLogger( __name__ ) def restrict_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.name in metabolomics_tools: # logging.warn( 'FILTER MATCHED: %s' %(tool.name)) for user_role in user.roles: if user_role.role.name == "PRIMS_METABOLOMICS": return True # not found to have the role, return false: return False else: # return true for any other tool return True 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 at https://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 http://www.pri.wur.nl<http://www.pri.wur.nl/>