diff options
author | ramon <ramongomez@us.es> | 2017-06-05 09:20:49 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-06-05 09:20:49 +0000 |
commit | b8498a147e8640eddbf337e3ed74660f48e1224d (patch) | |
tree | 366ca640a64580724df77688f8716e6a3cd29880 /server/bin/oglivecli | |
parent | bc3a350e227560b81948f2c5992dca0406e10e46 (diff) |
#768: Script {{{oglivecli}}} permite que usuario web ejecute operaciones de consulta.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5339 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'server/bin/oglivecli')
-rwxr-xr-x | server/bin/oglivecli | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/bin/oglivecli b/server/bin/oglivecli index 31f9cd07..9b217f0e 100755 --- a/server/bin/oglivecli +++ b/server/bin/oglivecli @@ -447,15 +447,21 @@ DEFOGLIVE=ogLive INFOFILE=$OPENGNSYS/etc/ogliveinfo.json # Access control. -[ "$USER" = "root" ] || raiseError access "Need to be root." +[ -r $OPENGNSYS/www/controlacceso.php ] && ACCESS="web" +[ "$USER" = "root" ] && ACCESS="root" +[ -z "$ACCESS" ] && raiseError access "Need to be root." # Check dependencies. JQ=$(which jq 2>/dev/null) || raiseError notfound "Need to install \"jq\"." which sponge &>/dev/null || raiseError notfound "Need to install \"moreutils\"." # Commands control. +shopt -s extglob +case "$ACCESS" in + root) CMDS='+(help|convert|config|check|list|show|search|download|install|uninstall|get-default|set-default|rebuild|assign)' ;; + web) CMDS='+(list|show|search|get-default)' ;; +esac case "$1" in - help|convert|config|check|list|show|search|download|install|uninstall|get-default|set-default|rebuild|assign) - COMMAND="${1/-/}"; shift; $COMMAND "$@" ;; - *) raiseError usage ;; + $CMDS) COMMAND="${1/-/}"; shift; $COMMAND "$@" ;; + *) raiseError usage ;; esac exit $? |