tazbug rev 105

Overall improvments
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 18:12:00 2017 +0100 (2017-02-10)
parents 6f798394f27e
children 1a43d9e16913
files web/bugs.cgi web/plugins/debug/debug.cgi web/plugins/debug/debug.conf web/style.css
line diff
     1.1 --- a/web/bugs.cgi	Fri Feb 10 17:19:52 2017 +0100
     1.2 +++ b/web/bugs.cgi	Fri Feb 10 18:12:00 2017 +0100
     1.3 @@ -308,8 +308,13 @@
     1.4  		if [ "$STATUS" == "OPEN" ]; then
     1.5  			cat << EOT
     1.6  <a href="?id=$id&amp;close">$(gettext "Close bug")</a>
     1.7 +EOT
     1.8 +		# Only original user and admin can edit a bug
     1.9 +		if [ "$user" == "$CREATOR" ] || admin_user; then
    1.10 +			cat << EOT
    1.11  <a href="?edit=$id">$(gettext "Edit bug")</a>
    1.12  EOT
    1.13 +		fi
    1.14  		else
    1.15  			cat << EOT
    1.16  <a href="?id=$id&amp;open">$(gettext "Re open bug")</a>
    1.17 @@ -448,10 +453,14 @@
    1.18  EOT
    1.19  }
    1.20  
    1.21 -
    1.22  # Edit/Save a bug
    1.23  edit_bug() {
    1.24  	. $bugdir/$id/bug.conf
    1.25 +	if admin_user || [ "$user" == "$CREATOR" ]; then
    1.26 +		continue
    1.27 +	else
    1.28 +		gettext "You can't edit someone else bug!" && exit 0
    1.29 +	fi
    1.30  	cat << EOT
    1.31  <h2>$(eval_gettext 'Edit Bug $bug')</h2>
    1.32  <div id="edit">
     2.1 --- a/web/plugins/debug/debug.cgi	Fri Feb 10 17:19:52 2017 +0100
     2.2 +++ b/web/plugins/debug/debug.cgi	Fri Feb 10 18:12:00 2017 +0100
     2.3 @@ -8,8 +8,8 @@
     2.4  	header
     2.5  	html_header
     2.6  	user_box
     2.7 -	if ! check_auth; then
     2.8 -		gettext "You must be logged in to view the dashboard"
     2.9 +	if check_auth && ! admin_user; then
    2.10 +		gettext "You must be admin to debug"
    2.11  		exit 0
    2.12  	fi
    2.13  	cat << EOT
     3.1 --- a/web/plugins/debug/debug.conf	Fri Feb 10 17:19:52 2017 +0100
     3.2 +++ b/web/plugins/debug/debug.conf	Fri Feb 10 18:12:00 2017 +0100
     3.3 @@ -3,7 +3,12 @@
     3.4  PLUGIN="Debug Tazbug"
     3.5  SHORT_DESC="Debug and clean-up Tazbug database"
     3.6  MAINTAINER="devel@slitaz.org"
     3.7 +
     3.8 +# Authenticated users
     3.9  PLUGINS_TOOLS="${PLUGINS_TOOLS}"
    3.10 -DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?debug'>Debug</a>"
    3.11 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}"
    3.12 +
    3.13 +# Admin only in Dashboard
    3.14 +ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?debug'>Debug</a>"
    3.15  
    3.16  # Configurable variables used in plugin.cgi
     4.1 --- a/web/style.css	Fri Feb 10 17:19:52 2017 +0100
     4.2 +++ b/web/style.css	Fri Feb 10 18:12:00 2017 +0100
     4.3 @@ -116,9 +116,9 @@
     4.4  	max-width: 720px;
     4.5  }
     4.6  
     4.7 -#newbug textarea { width: 480px; }
     4.8 +#newbug textarea, #edit textarea { width: 490px; height: 180px; }
     4.9  
    4.10 -#edit textarea { width: 100%; height: 240px; }
    4.11 +/* #edit textarea { width: 100%; height: 240px; } */
    4.12  
    4.13  .box, pre, #login, #account-info {
    4.14  	background-color: #f8f8f8;