From 6470f77759195e31bcf6136eb087f18ec3366bbf Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 27 Feb 2016 22:26:59 +0000 Subject: [PATCH] Administrator menu --- src/freedombone-controlpanel-user | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/freedombone-controlpanel-user b/src/freedombone-controlpanel-user index 0349396e..b9833771 100755 --- a/src/freedombone-controlpanel-user +++ b/src/freedombone-controlpanel-user @@ -539,6 +539,16 @@ function menu_email { done } +function menu_admin { + if [ ! -f /etc/sudoers ]; then + exit 0 + fi + if grep -q "$USER ALL=(ALL) ALL" /etc/sudoers; then + sudo freedombone-controlpanel + else + exit + fi +} function menu_top_level { while true @@ -547,15 +557,16 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone User Control Panel" \ --title $"User Control Panel" \ - --radiolist $"Choose an operation:" 15 50 8 \ + --radiolist $"Choose an operation:" 16 50 9 \ 1 $"Use Email" off \ 2 $"Change Email Filtering Rules" off \ 3 $"Use Tox Chat" off \ 4 $"Use XMPP Chat" off \ 5 $"Use IRC" off \ 6 $"Your Encryption Keys" off \ - 7 $"Exit to the command line" off \ - 8 $"Log out" on 2> $data + 7 $"Adminitrstor controls" off \ + 8 $"Exit to the command line" off \ + 9 $"Log out" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -568,8 +579,9 @@ function menu_top_level { 4) torify profanity;; 5) torify irssi;; 6) menu_encryption_keys;; - 7) break;; - 8) kill -HUP `pgrep -s 0 -o`;; + 7) menu_admin;; + 8) break;; + 9) kill -HUP `pgrep -s 0 -o`;; esac done }