Hi Jeremy, thank you for your answer. I followed your hint modifyng (for example) the ucsc_tablebrowser.xml as follows (not sure about the <display> tag to have a simple error message, but this is another problem): <tool name="UCSC Main" id="ucsc_table_direct1" tool_type="data_source"> <description>table browser</description> <command interpreter="python"> #if $__user_email__ == "" <display>You are not authorized to use this tool</display> #else data_source.py $output $__app__.config.output_size_limit #end if </command> ... and I got the error below, which seems connected to the cheetah syntax. Any idea of what I'm doing wrong? Cheers, I. Traceback (most recent call last): File "/home/galaxy/galaxy-dist/lib/galaxy/jobs/runners/local.py", line 58, in run_job job_wrapper.prepare() File "/home/galaxy/galaxy-dist/lib/galaxy/jobs/__init__.py", line 411, in prepare self.command_line = self.tool.build_command_line( param_dict ) File "/home/galaxy/galaxy-dist/lib/galaxy/tools/__init__.py", line 1691, in build_command_line command_line = fill_template( self.command, context=param_dict ) File "/home/galaxy/galaxy-dist/lib/galaxy/util/template.py", line 9, in fill_template return str( Template( source=template_text, searchList=[context] ) ) File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Template.py", line 1244, in __init__ self._compile(source, file, compilerSettings=compilerSettings) File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Template.py", line 1538, in _compile keepRefToGeneratedCode=True) File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Template.py", line 745, in compile compiler.compile() File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Compiler.py", line 1670, in compile self._parser.parse() File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Parser.py", line 1496, in parse self.assertEmptyOpenDirectivesStack() File "/home/galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.5-linux-x86_64-ucs4.egg/Cheetah/Parser.py", line 2658, in assertEmptyOpenDirectivesStack raise ParseError(self, msg=errorMsg) ParseError: Some #directives are missing their corresponding #end ___ tag: if Line 2, column 8 Line|Cheetah Code ----|------------------------------------------------------------- 2 | ^
Ivan,
#if $__user_email__ == "" <display>You are not authorized to use this tool</display> #else
<command interpreter="python"> data_source.py $output $__app__.config.output_size_limit </command>
To make this approach work, the email check should go in the command tag.
More information:
If you're looking to require users to login before using any tools, you can use this flag in the universe config file:
# Force everyone to log in (disable anonymous access). #require_login = False
If you're looking to implement tool-based access control, the best approach is probably to use the same role-based approach that libraries use:
https://bitbucket.org/galaxy/galaxy-central/issue/269/use-galaxy-security-to...
Thanks, J.