From 82912629ff6775accc9d4a513d440b8228ab4474 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Mon, 8 Aug 2011 14:19:44 -0500 Subject: Add handler for top level unprivledged command expansion in node conversion function --- functions/interpreter/vyatta-op-run | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'functions') diff --git a/functions/interpreter/vyatta-op-run b/functions/interpreter/vyatta-op-run index ea451e5..4d223df 100644 --- a/functions/interpreter/vyatta-op-run +++ b/functions/interpreter/vyatta-op-run @@ -82,6 +82,18 @@ _vyatta_op_conv_node_path () fi elif [[ -d "$node_path/$node" ]]; then echo $node + elif [[ "$VYATTA_USER_LEVEL_DIR" != "/opt/vyatta/etc/shell/level/admin" ]];then + # special handling for unprivledged completions. + # Since top level commands are different for unprivledged users + # we need a handler to expand them properly. + local -a filtered_cmds=() + local -a allowed=( $(cat $VYATTA_USER_LEVEL_DIR/allowed-op.in) ) + get_prefix_filtered_list $node allowed filtered_cmds + if [[ "${#filtered_cmds[@]}" == "1" ]];then + echo ${filtered_cmds[0]} + else + echo "${node} ambiguous" + fi else echo "$node ambiguous" fi -- cgit v1.2.3