# HG changeset patch # User Christophe Lincoln # Date 1389133039 -3600 # Node ID d88736defba5522af36b123f68db7b9036781cf2 # Parent 17bc5f665bf5b909e132bd6e93091486e9995694 Add users plugin (splited from dashboard) and improve it. This plugin is compatible with TinyCM diff -r 17bc5f665bf5 -r d88736defba5 web/plugins/dashboard/dashboard.cgi --- a/web/plugins/dashboard/dashboard.cgi Tue Jan 07 22:41:49 2014 +0100 +++ b/web/plugins/dashboard/dashboard.cgi Tue Jan 07 23:17:19 2014 +0100 @@ -1,66 +1,10 @@ #!/bin/sh # -# TinyCM/TazBug Plugin - Dashboard +# TazBug Plugin - Dashboard # . /usr/lib/slitaz/httphelper case " $(GET) " in - *\ users\ *) - d="Users" - header - html_header - user_box - if check_auth && ! admin_user; then - gettext "You must be admin to manage users." - exit 0 - fi - users=$(ls -1 $PEOPLE | wc -l) - cat << EOT -

Users: $users

-
- Dashboard -
-
-EOT
-		for u in $(ls $PEOPLE)
-		do
-			. "${PEOPLE}/${u}/account.conf"
-			cat << EOT
-$(get_gravatar $MAIL 24) $USER | $NAME | $MAIL
-EOT
-# deluser link
-#: $(gettext "delete")
-			unset NAME USER 
-		done
-		echo "
" && exit 0 ;; - - *\ online\ *) - # Show online users based on sessions files. - d="Online users" - header - html_header - user_box - if ! check_auth; then - gettext "You must be logged in to view online user" - exit 0 - fi - cat << EOT -

Online users

-
- Dashboard -
-
-EOT
-		for u in $(ls $sessions)
-		do
-			. "${PEOPLE}/${u}/account.conf"
-			cat << EOT
-$(get_gravatar $MAIL 24) $USER | $NAME
-EOT
-		done
-		echo "
" - html_footer && exit 0 ;; - *\ dashboard\ *) d="Dashboard" users=$(ls -1 $PEOPLE | wc -l) @@ -73,15 +17,19 @@ gettext "You must be logged in to view the dashboard" exit 0 fi - if check_auth && admin_user; then - admintools="List users" + # Source all plugins configs to get DASHBOARD_TOOLS and ADMIN_TOOLS + for p in $(ls $plugins) + do + . $plugins/$p/$p.conf + done + if check_auth && ! admin_user; then + ADMIN_TOOLS="" fi cat << EOT

Dashboard

- Online users - $admintools + $DASHBOARD_TOOLS $ADMIN_TOOLS
@@ -104,12 +52,12 @@
 

$(gettext "Plugins")

 EOT
+		# List all plugins
 		for p in $(ls -1 $plugins)
 		do
 			. $plugins/$p/$p.conf
 			echo "$PLUGIN - $SHORT_DESC"
 		done
 		echo '
' - html_footer - exit 0 ;; + html_footer && exit 0 ;; esac diff -r 17bc5f665bf5 -r d88736defba5 web/plugins/dashboard/dashboard.conf --- a/web/plugins/dashboard/dashboard.conf Tue Jan 07 22:41:49 2014 +0100 +++ b/web/plugins/dashboard/dashboard.conf Tue Jan 07 23:17:19 2014 +0100 @@ -1,8 +1,10 @@ -# TinycM/TazBug Plugin configuration +# TazBug Plugin configuration PLUGIN="TazBug Dashboard" SHORT_DESC="Light TazBug Dashboard" MAINTAINER="devel@slitaz.org" + +# Authentfied users PLUGINS_TOOLS="Dashboard ${PLUGINS_TOOLS}" # Configurable variables used in plugin.cgi diff -r 17bc5f665bf5 -r d88736defba5 web/plugins/users/users.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/users/users.cgi Tue Jan 07 23:17:19 2014 +0100 @@ -0,0 +1,64 @@ +#!/bin/sh +# +# TinyCM/TazBug Plugin - Users Admin +# +. /usr/lib/slitaz/httphelper + +case " $(GET) " in + *\ users\ *) + d="Users" + header + html_header + user_box + if check_auth && ! admin_user; then + gettext "You must be admin to manage users" + exit 0 + fi + users=$(ls -1 $PEOPLE | wc -l) + cat << EOT +

Users: $users

+ +
+EOT
+		for u in $(ls $PEOPLE)
+		do
+			. "${PEOPLE}/${u}/account.conf"
+			cat << EOT
+$(get_gravatar $MAIL 24) $USER | $NAME | $MAIL
+EOT
+# deluser link
+#: $(gettext "delete")
+			unset NAME USER 
+		done
+		echo "
" && exit 0 ;; + + *\ online\ *) + # Show online users based on sessions files. + d="Online users" + header + html_header + user_box + if ! check_auth; then + gettext "You must be logged in to view online user" + exit 0 + fi + cat << EOT +

Online users

+ +
+EOT
+		for u in $(ls $sessions)
+		do
+			. "${PEOPLE}/${u}/account.conf"
+			cat << EOT
+$(get_gravatar $MAIL 24) $USER | $NAME
+EOT
+		done
+		echo "
" + html_footer && exit 0 ;; +esac diff -r 17bc5f665bf5 -r d88736defba5 web/plugins/users/users.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/users/users.conf Tue Jan 07 23:17:19 2014 +0100 @@ -0,0 +1,14 @@ +# TinyCM/TazBug Plugin configuration + +PLUGIN="Users Admin" +SHORT_DESC="Handle TinyCM/TazBug users" +MAINTAINER="devel@slitaz.org" + +# Authentfied users +PLUGINS_TOOLS="${PLUGINS_TOOLS}" +DASHBOARD_TOOLS="Online users" + +# Admin only in Dashboard +ADMIN_TOOLS="${ADMIN_TOOLS} List users" + +# Configurable variables used in plugin.cgi