Browse Source

Administrator menu

Bob Mottram 9 years ago
parent
commit
6470f77759
1 changed files with 17 additions and 5 deletions
  1. 17
    5
      src/freedombone-controlpanel-user

+ 17
- 5
src/freedombone-controlpanel-user View File

@@ -539,6 +539,16 @@ function menu_email {
539 539
     done
540 540
 }
541 541
 
542
+function menu_admin {
543
+    if [ ! -f /etc/sudoers ]; then
544
+        exit 0
545
+    fi
546
+    if grep -q "$USER  ALL=(ALL) ALL" /etc/sudoers; then
547
+        sudo freedombone-controlpanel
548
+    else
549
+        exit
550
+    fi
551
+}
542 552
 
543 553
 function menu_top_level {
544 554
     while true
@@ -547,15 +557,16 @@ function menu_top_level {
547 557
         trap "rm -f $data" 0 1 2 5 15
548 558
         dialog --backtitle $"Freedombone User Control Panel" \
549 559
                --title $"User Control Panel" \
550
-               --radiolist $"Choose an operation:" 15 50 8 \
560
+               --radiolist $"Choose an operation:" 16 50 9 \
551 561
                1 $"Use Email" off \
552 562
                2 $"Change Email Filtering Rules" off \
553 563
                3 $"Use Tox Chat" off \
554 564
                4 $"Use XMPP Chat" off \
555 565
                5 $"Use IRC" off \
556 566
                6 $"Your Encryption Keys" off \
557
-               7 $"Exit to the command line" off \
558
-               8 $"Log out" on 2> $data
567
+               7 $"Adminitrstor controls" off \
568
+               8 $"Exit to the command line" off \
569
+               9 $"Log out" on 2> $data
559 570
         sel=$?
560 571
         case $sel in
561 572
             1) exit 1;;
@@ -568,8 +579,9 @@ function menu_top_level {
568 579
             4) torify profanity;;
569 580
             5) torify irssi;;
570 581
             6) menu_encryption_keys;;
571
-            7) break;;
572
-            8) kill -HUP `pgrep -s 0 -o`;;
582
+            7) menu_admin;;
583
+            8) break;;
584
+            9) kill -HUP `pgrep -s 0 -o`;;
573 585
         esac
574 586
     done
575 587
 }