Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/templates/web/hooks_wrapper.sh.erb

Issue 29733731: #7320 - Introduce helpcenter role (Closed)
Patch Set: For comments 2 to 4 Created April 2, 2018, 10:36 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/adblockplus/templates/web/hooks_wrapper.sh.erb
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/templates/web/hooks_wrapper.sh.erb
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# This script is a wrapper of accesible commands via ssh ForceCommand option
mathias 2018/04/05 01:12:31 This should mention that it is to ensure only the
f.lopez 2018/04/10 02:45:40 Acknowledged.
+set -- $SSH_ORIGINAL_COMMAND
mathias 2018/04/05 01:12:30 Instead of replacing "$@" here you should pass on
f.lopez 2018/04/10 02:45:40 Acknowledged.
+command="$1"; shift
+case "$command" in
+ <%- @hooks.each do |command, values| -%>
mathias 2018/04/05 01:12:31 I prefer when the template brackets (`<%`) are use
f.lopez 2018/04/10 02:45:40 Acknowledged.
+ <%= command %>)
+ /home/<%= @deploy_user %>/bin/<%= command %> "$@"
mathias 2018/04/05 01:12:31 This should not repeat the convention from hook.pp
f.lopez 2018/04/10 02:45:39 Acknowledged.
+ ;;
+ <%- end -%>
+ *)
+ echo "Sorry. Only these commands are available to you:"
mathias 2018/04/05 01:12:31 Please don't use personal articulation, stuff like
f.lopez 2018/04/10 02:45:40 Acknowledged.
+ <%- @hooks.keys.select { |key| key.to_s}.each do |value| -%>
mathias 2018/04/05 01:12:30 Aren't the key's strings anyway? And even if not,
f.lopez 2018/04/10 02:45:40 Acknowledged.
+ echo <%= value %>
+ <%- end -%>
+ exit 1
+ ;;
+esac

Powered by Google App Engine
This is Rietveld