Administrator menu

This commit is contained in:
Bob Mottram 2016-02-27 22:26:59 +00:00
parent c274d7d2ae
commit 6470f77759
1 changed files with 17 additions and 5 deletions

View File

@ -539,6 +539,16 @@ function menu_email {
done 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 { function menu_top_level {
while true while true
@ -547,15 +557,16 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \ dialog --backtitle $"Freedombone User Control Panel" \
--title $"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 \ 1 $"Use Email" off \
2 $"Change Email Filtering Rules" off \ 2 $"Change Email Filtering Rules" off \
3 $"Use Tox Chat" off \ 3 $"Use Tox Chat" off \
4 $"Use XMPP Chat" off \ 4 $"Use XMPP Chat" off \
5 $"Use IRC" off \ 5 $"Use IRC" off \
6 $"Your Encryption Keys" off \ 6 $"Your Encryption Keys" off \
7 $"Exit to the command line" off \ 7 $"Adminitrstor controls" off \
8 $"Log out" on 2> $data 8 $"Exit to the command line" off \
9 $"Log out" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) exit 1;; 1) exit 1;;
@ -568,8 +579,9 @@ function menu_top_level {
4) torify profanity;; 4) torify profanity;;
5) torify irssi;; 5) torify irssi;;
6) menu_encryption_keys;; 6) menu_encryption_keys;;
7) break;; 7) menu_admin;;
8) kill -HUP `pgrep -s 0 -o`;; 8) break;;
9) kill -HUP `pgrep -s 0 -o`;;
esac esac
done done
} }