tazbug annotate web/plugins/users/users.cgi @ rev 66

Add users plugin (splited from dashboard) and improve it. This plugin is compatible with TinyCM
author Christophe Lincoln <pankso@slitaz.org>
date Tue Jan 07 23:17:19 2014 +0100 (2014-01-07)
parents
children 95ac80c4d7b2
rev   line source
pankso@66 1 #!/bin/sh
pankso@66 2 #
pankso@66 3 # TinyCM/TazBug Plugin - Users Admin
pankso@66 4 #
pankso@66 5 . /usr/lib/slitaz/httphelper
pankso@66 6
pankso@66 7 case " $(GET) " in
pankso@66 8 *\ users\ *)
pankso@66 9 d="Users"
pankso@66 10 header
pankso@66 11 html_header
pankso@66 12 user_box
pankso@66 13 if check_auth && ! admin_user; then
pankso@66 14 gettext "You must be admin to manage users"
pankso@66 15 exit 0
pankso@66 16 fi
pankso@66 17 users=$(ls -1 $PEOPLE | wc -l)
pankso@66 18 cat << EOT
pankso@66 19 <h2>Users: $users</h2>
pankso@66 20 <div id="tools">
pankso@66 21 <a href="$script?dashboard">Dashboard</a>
pankso@66 22 <a href='?online'>Online users</a>
pankso@66 23 </div>
pankso@66 24 <pre>
pankso@66 25 EOT
pankso@66 26 for u in $(ls $PEOPLE)
pankso@66 27 do
pankso@66 28 . "${PEOPLE}/${u}/account.conf"
pankso@66 29 cat << EOT
pankso@66 30 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL
pankso@66 31 EOT
pankso@66 32 # deluser link
pankso@66 33 #: <a href="?users&amp;deluser=$USER">$(gettext "delete")</a>
pankso@66 34 unset NAME USER
pankso@66 35 done
pankso@66 36 echo "</pre>" && exit 0 ;;
pankso@66 37
pankso@66 38 *\ online\ *)
pankso@66 39 # Show online users based on sessions files.
pankso@66 40 d="Online users"
pankso@66 41 header
pankso@66 42 html_header
pankso@66 43 user_box
pankso@66 44 if ! check_auth; then
pankso@66 45 gettext "You must be logged in to view online user"
pankso@66 46 exit 0
pankso@66 47 fi
pankso@66 48 cat << EOT
pankso@66 49 <h2>Online users</h2>
pankso@66 50 <div id="tools">
pankso@66 51 <a href="$script?dashboard">Dashboard</a>
pankso@66 52 </div>
pankso@66 53 <pre>
pankso@66 54 EOT
pankso@66 55 for u in $(ls $sessions)
pankso@66 56 do
pankso@66 57 . "${PEOPLE}/${u}/account.conf"
pankso@66 58 cat << EOT
pankso@66 59 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME
pankso@66 60 EOT
pankso@66 61 done
pankso@66 62 echo "</pre>"
pankso@66 63 html_footer && exit 0 ;;
pankso@66 64 esac