tazbug diff web/plugins/dashboard/dashboard.cgi @ rev 63
Add online users in dashboard and misc changes
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Jan 07 22:22:25 2014 +0100 (2014-01-07) |
parents | f005632d7c8b |
children | 41de444b2aa3 |
line diff
1.1 --- a/web/plugins/dashboard/dashboard.cgi Tue Jan 07 20:15:56 2014 +0100 1.2 +++ b/web/plugins/dashboard/dashboard.cgi Tue Jan 07 22:22:25 2014 +0100 1.3 @@ -10,7 +10,7 @@ 1.4 header 1.5 html_header 1.6 user_box 1.7 - if ! admin_user; then 1.8 + if check_auth && ! admin_user; then 1.9 gettext "You must be admin to manage users." 1.10 exit 0 1.11 fi 1.12 @@ -33,6 +33,26 @@ 1.13 unset NAME USER 1.14 done 1.15 echo "</pre>" && exit 0 ;; 1.16 + 1.17 + *\ online\ *) 1.18 + # Show online users based on sessions files. 1.19 + d="Online users" 1.20 + header 1.21 + html_header 1.22 + user_box 1.23 + cat << EOT 1.24 +<h2>Online users</h2> 1.25 +<pre> 1.26 +EOT 1.27 + for u in $(ls $sessions) 1.28 + do 1.29 + . "${PEOPLE}/${u}/account.conf" 1.30 + cat << EOT 1.31 +$(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME 1.32 +EOT 1.33 + done 1.34 + echo "</pre>" 1.35 + html_footer && exit 0 ;; 1.36 1.37 *\ dashboard\ *) 1.38 d="Dashboard" 1.39 @@ -46,8 +66,9 @@ 1.40 gettext "You must be logged in to view the dashboard." 1.41 exit 0 1.42 fi 1.43 - if admin_user; then 1.44 - admintools="<a href='?users'>Users</a>" 1.45 + if check_auth && admin_user; then 1.46 + # Online users should not be public ? 1.47 + admintools="<a href='?users'>List users</a>" 1.48 fi 1.49 cat << EOT 1.50 <h2>Dashboard</h2> 1.51 @@ -57,6 +78,7 @@ 1.52 Bugsize : $bugsize 1.53 </pre> 1.54 <div id="tools"> 1.55 + <a href='?online'>Online users</a> 1.56 $admintools 1.57 </div> 1.58 <h3>Admin users</h3>