diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-08-08 14:19:44 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-08-08 14:19:44 -0500 |
commit | 82912629ff6775accc9d4a513d440b8228ab4474 (patch) | |
tree | 68d458968c39d5326d748588a0802e7df6360a18 /functions/interpreter | |
parent | 6f9a4418817d8f920e7f64058d8c9b1c148b4e6a (diff) | |
download | vyatta-op-82912629ff6775accc9d4a513d440b8228ab4474.tar.gz vyatta-op-82912629ff6775accc9d4a513d440b8228ab4474.zip |
Add handler for top level unprivledged command expansion in node conversion function
Diffstat (limited to 'functions/interpreter')
-rw-r--r-- | functions/interpreter/vyatta-op-run | 12 |
1 files changed, 12 insertions, 0 deletions
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 |