Przeglądaj źródła

Administrator menu

Bob Mottram 9 lat temu
rodzic
commit
6470f77759
1 zmienionych plików z 17 dodań i 5 usunięć
  1. 17
    5
      src/freedombone-controlpanel-user

+ 17
- 5
src/freedombone-controlpanel-user Wyświetl plik

539
     done
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
 function menu_top_level {
553
 function menu_top_level {
544
     while true
554
     while true
547
         trap "rm -f $data" 0 1 2 5 15
557
         trap "rm -f $data" 0 1 2 5 15
548
         dialog --backtitle $"Freedombone User Control Panel" \
558
         dialog --backtitle $"Freedombone User Control Panel" \
549
                --title $"User Control Panel" \
559
                --title $"User Control Panel" \
550
-               --radiolist $"Choose an operation:" 15 50 8 \
560
+               --radiolist $"Choose an operation:" 16 50 9 \
551
                1 $"Use Email" off \
561
                1 $"Use Email" off \
552
                2 $"Change Email Filtering Rules" off \
562
                2 $"Change Email Filtering Rules" off \
553
                3 $"Use Tox Chat" off \
563
                3 $"Use Tox Chat" off \
554
                4 $"Use XMPP Chat" off \
564
                4 $"Use XMPP Chat" off \
555
                5 $"Use IRC" off \
565
                5 $"Use IRC" off \
556
                6 $"Your Encryption Keys" off \
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
         sel=$?
570
         sel=$?
560
         case $sel in
571
         case $sel in
561
             1) exit 1;;
572
             1) exit 1;;
568
             4) torify profanity;;
579
             4) torify profanity;;
569
             5) torify irssi;;
580
             5) torify irssi;;
570
             6) menu_encryption_keys;;
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
         esac
585
         esac
574
     done
586
     done
575
 }
587
 }