public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* Adding "Approval" Mechanism
@ 2004-11-24 18:20 Pankaj Garg
  0 siblings, 0 replies; 3+ messages in thread
From: Pankaj Garg @ 2004-11-24 18:20 UTC (permalink / raw)
  To: David.Gathright; +Cc: help-gnats

  Saw your posting on the Gnats mailing list from a while ago
about adding an "Approval" mechanism in Gnats. I think this
might be doable using a field's 'on-change' trigger, but was
wondering if you've already solved this.

  Thanks

Pankaj

  --
  Pankaj K Garg                         garg@zeesource.net
  1684 Nightingale Avenue     408-373-4027
  Suite 201                                  408-733-2737(fax)
  Sunnyvale, CA 94087            http://www.zeesource.net



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread
* RE: Adding "Approval" Mechanism
@ 2004-11-25 17:22 Andrew Kemp
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Kemp @ 2004-11-25 17:22 UTC (permalink / raw)
  To: help-gnats

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

Hi,

I have cobbled something into gnatsweb to support an approval system
through emails. Firstly I edited the dbconfig file fairly heavily so
that gnatsweb sends HTML emails. The main mail that is sent out is
whenever there is an audit trail change.

In our local Gnats DB we have a state "awaiting-approval" as well as
"approved" and a few other new ones. For each possible state I create a
separate DIV in the HTML mail and use inline CSS style to say which one
is displayed. This is controlled with CSS lines in the dbconfig like

   div { display: none }\n\
   div.%s { display: inline }\n\

and the format element used is 'State'.

In the "awaiting-approval" state, the mail contains two big buttons for
Accept / Reject which the originator can click on. This uses an
additional field in the Gnats link to bypass the normal login and use an
account which has edit access. This required a small hack to
gnatsweb.pl.

The link I use is

h**p://someserver/cgi-bin/gnats/gnatsweb.pl/1?submittype=mail&pr=%s&cmd=
submit edit&State=approved&database=default&State-Changed-Why=%s
email_approval

It is the "submittype=mail" field that I use to bypass the login. I know
that this provides a potential edit backdoor, but Gnats security is not
great anyway and I trust my users who are all local :-)


Cheesey, but it works!

Andy.

I have attached my dbconfig if you want to see what I have done. You
will have to add your own images.

[-- Attachment #2: dbconfig --]
[-- Type: application/octet-stream, Size: 9436 bytes --]

#
# This message is used when mailing an initial response back to the 
# PR submitter.
#

mail-format "initial-response-to-submitter" {
    from-address {
	fixed-address "gnats-admin"
    }

    # For addresses that are joined with |, we try each one in turn, from
    # left to right,  until we find one that's non-empty.
    # Multiple addresses may be listed here.
    to-addresses {
	"Reply-To:" | "From:" | "From" | "Submitter-Id"
    }

    header {
	format "Subject: GNATS: Re: %s/%s: %s\n\
Content-Type: text/html;\n"

	fields { "Category" "Number" "Subject:" }
    }

    body {
format "\
\
\
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n\
\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n\
\n\
<HTML>\n\
 <head>\n\
  <title>PR submission notification PR/%s</title>\n\
  <STYLE type=\"text/css\">\n\
    body {background-color: #d0e0ff;font: 10pt sans-serif;margin: 2px 4ex 2px 4ex;border: 3px solid #7010a0;padding: 1.5ex;color: black }\n\
    h1 {color: white;padding: 1ex;display: block;background-color: #0077b3;border: outset #b0c0e0;font-size: 14pt }\n\
    a {color: #0077b3}\n\
    a:hover {color: #7010a0;}\n\
    pre {font-size: 10pt }\n\
  </STYLE>\n\
 </head>\n\
\
<body>\n\
<H1>PR submission notification PR/%s</H1>\n\
\n\
<PRE>\n\
Thank you very much for your problem report.\n\
It has the internal identification `%s/%s'.\n\
The individual assigned to look at your\n\
report is: <B>%s</B>. \n\
\n\
You can view the status of this report by following the link \n\
\n\
</PRE><A HREF=\"http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s\">\n\
<PRE>http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s</A>\n\
\n\
%F%F%F%F\n\
</PRE>\n\
</body>\n\
</html>\n\
"
	fields { "Number" "Number" "Category" "Number" "Responsible[fullname]" "Number"
	         "Number" "Category" "Responsible" "Synopsis" "Arrival-Date" }
    }
}

#
# The message sent to the responsible parties when a new non-pending
# PR arrives.
#

mail-format "initial-pr-notification" {
    # Who the mail is from.
    from-address {
	"From:" | "From"
    }

    # We send mail to the responsible person, the addresses listed in
    # the contact and notify fields of the submitter adm file entry for
    # the Submitter-Id, and the notify person listed in the category
    # adm file.
    to-addresses {
	"Responsible"
	"Submitter-Id[contact]"
	"Submitter-Id[notify]"
	"Category[notify]"
    }

    # The reply-to address; either use the Reply-To: or From: header values 
    # from the PR, or the Submitter-Id's mail address.
    reply-to {
	"Reply-To:" | "From:" | "Submitter-Id"
    }

    # Any additional header text we want to add.  Must have a newline at the
    # end of each line.
    header {
	format "Subject: GNATS: %s/%s: %s\nCc: %s\n\
Content-Type: text/html;\n"
	fields { "Category" "Number" "Subject:" "Notify-List" }
    }

    body {
format "\
\
\
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n\
\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n\
\n\
<HTML>\n\
 <head>\n\
  <title>PR submission notification PR/%s</title>\n\
  <STYLE type=\"text/css\">\n\
    body {background-color: #d0e0ff;font: 10pt sans-serif;margin: 2px 4ex 2px 4ex;border: 3px solid #7010a0;padding: 1.5ex;color: black }\n\
    h1 {color: white;padding: 1ex;display: block;background-color: #0077b3;border: outset #b0c0e0;font-size: 14pt }\n\
    a {color: #0077b3}\n\
    a:hover {color: #7010a0;}\n\
    pre {font-size: 10pt }\n\
  </STYLE>\n\
 </head>\n\
\
<body>\n\
<H1>PR submission notification PR/%s</H1>\n\
\n\
<PRE>\n\
The following PR has been submitted by <B>%s</B>.\n\
It has the internal identification `%s/%s'.\n\
\n\
You can view the status of this report by following the link \n\
\n\
</PRE><A HREF=\"http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s\">\n\
<PRE>http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s</A>\n\
\n\
Or you can edit it with this link \n\
\n\
</PRE><A HREF=\"http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=edit&pr=%s\">\n\
<PRE>http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=edit&pr=%s</A>\n\
\n\
%F%F%F%F\n\
</PRE>\n\
</body>\n\
</html>\n\
"
	fields { "Number" "Number" "Originator" "Category" "Number" "Number" "Number" "Number"
	         "Number" "Category" "Responsible" "Synopsis" "Arrival-Date" }
    }
}

#
# This format is used for initial PRs that end up as pending PRs.
#
mail-format "initial-pr-notification-pending" {
    #
    # Is this good?
    #
    from-address {
	"From:" | "From"
    }

    #
    # Boring--we only tell gnats-admin about it.
    #
    to-addresses {
	fixed-address "gnats-admin"
    }

    #
    # Questionable for a pending PR.
    #
    reply-to {
	"Reply-To:" | "From:" | "Submitter-Id"
    }

    header {
	format "Subject: GNATS: %s/%s: %s (pending)\nCc: %s\n"
	fields { "Category" "Number" "Subject:" "Notify-List" }
    }

    body {
#
#       See above.
#
#	($ExpireTime != "") {
#		format "\tThe contract type is `%s' with a response time of %d business hours.\n"
#		fields { "Submitter-Id[type]" "$ExpireTime" }
#	}
	format "%P"
	fields { "$" }
    }
}

#
# Used when a response to a PR is received via email.
#
# The following parameters are passed in:
# $MailFrom -- the From: line of the original message
# $MailTo -- the To: line of the original message
# $MailSubject: The Subject: line of the original message
# $MailCC: The CC: line of the original message
# $NewAuditTrail -- the text of the new audit trail entry (the body of
#	            the message)
#
mail-format "appended-email-response" {
    from-address {
	"$MailFrom"
    }

    #
    # Should we send a copy to the user that sent in the message?
    #
    to-addresses {
	"Responsible"
	"Submitter-Id[contact]"
    }

    reply-to {
	"$MailFrom"
    }

    header {
	format "Subject: GNATS: %s/%s: %s\n"
	fields { "Category" "Number" "$MailSubject" }
    }

    body {
	format "The following reply was made to PR %s/%s; it has been noted by GNATS.\n\n%s"
	fields { "Category" "Number" "$NewAuditTrail" }
    }
}

#
# Used to send mail for a change that generates an Audit-Trail entry.
# The following parameters are available:
# $EditUserEmailAddr -- the email address of the user editing the PR
# $OldResponsible -- the previous Responsible field entry, if it was changed
# $NewAuditTrail -- the Audit-Trail: entries that have been appended
#		    by the edits
#
# AKK
mail-format "audit-mail" {
    from-address {
	"$EditUserEmailAddr"
    }

    #
    to-addresses {
	"Responsible"
	"$OldResponsible"
	"Category[notify]"
	"Submitter-Id[contact]"
	"$EditUserEmailAddr"
	"Reply-To:" | "From:" | "From"
    }

    #
    # ???  Good question!
    #
    #reply-to {
#	fixed-address "bugs"
#    }

    header {
	format "Subject: GNATS: Re: %s/%s\nCc: %s\n\
Content-Type: text/html;\n"
	fields { "Category" "Number" "Notify-List" }
    }

    body {
format "\
\
\
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n\
\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n\
\n\
<HTML>\n\
 <head>\n\
  <title>PR status change PR/%s</title>\n\
  <STYLE type=\"text/css\">\n\
    div { display: none }\n\
    div.%s { display: inline }\n\
    body {background-color: #d0e0ff;font: 10pt sans-serif;margin: 2px 4ex 2px 4ex;border: 3px solid #7010a0;padding: 1.5ex;color: black }\n\
    h1 {color: white;padding: 1ex;display: block;background-color: #0077b3;border: outset #b0c0e0;font-size: 14pt }\n\
    a {color: #0077b3}\n\
    a:hover {color: #7010a0;}\n\
    pre {font-size: 10pt }\n\
  </STYLE>\n\
 </head>\n\
\
<body>\n\
<H1>PR status change PR/%s</H1>\n\
\n\
<PRE>\n\
The PR submitted by %s regarding <B>%s</B> has had its status modified.\n\
\n\
\
</PRE>\n\
<DIV id=\"feedback\" class=\"feedback\">\n\
<P><B>%s has updated this PR and is awaiting feedback -  details on the link below<BR>\n\
<FONT COLOR=\"#ff4444\" SIZE=+1>Please can you give feedback on this call</B></FONT></P>\n\
</DIV>\n\
<PRE>\n\
\
\
\
\
</PRE>\n\
<DIV id=\"suspended\" class=\"suspended\">\n\
<P><B>%s has suspended this PR</B> - no further action is planned.</P>\n\
</DIV>\n\
<PRE>\n\
\
\
\
\
</PRE>\n\
<DIV id=\"approved\" class=\"approved\">\n\
<P><B>This PR has now been approved</B></P>\n\
</DIV>\n\
<PRE>\n\
\
\
\
\
You can view the details by following the link \n\
\n\
</PRE><A HREF=\"http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s\">\n\
<PRE>http://www/cgi-bin/gnats/gnatsweb.pl?database=default&cmd=view&pr=%s</A>\n\
\n\n\
</PRE>\n\
\
\
\
\
<DIV id=\"awaiting-approval\" class=\"awaiting-approval\">\n\
Please test the modifications and then click <I>Approve</I> or <I>Reject</I><BR>\n\
<a href=\"http://www/cgi-bin/gnats/gnatsweb.pl/1?submittype=mail&pr=%s&cmd=submit edit&State=approved&database=default&State-Changed-Why=%s email_approval\">\n\
<IMG BORDER=0 SRC=\"http://www/Intranet/Gnats/icons/accept.jpg\" WIDTH=191 HEIGHT=88 ALT=\"Accept\"></a><BR>\n\
<a href=\"http://www/cgi-bin/gnats/gnatsweb.pl/1?submittype=mail&pr=%s&cmd=submit edit&State=feedback&database=default&State-Changed-Why=%s email_rejection\">\n\
<IMG BORDER=0 SRC=\"http://www/Intranet/Gnats/icons/reject.jpg\" WIDTH=181 HEIGHT=88 ALT=\"Reject\"></a><BR>\n\
</DIV>\n\
\
\
\
\
<PRE>\n\n\
%s\n\
</PRE>\n\
</body>\n\
</html>\n\
"
	fields { "Number" "State" "Number" "Originator" "Synopsis" "Responsible[fullname]" "Responsible[fullname]" "Number" "Number" "Number" "Originator" "Number" "Originator" "$NewAuditTrail" }
    }
}


[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Adding "Approval" Mechanism
@ 2003-08-30  8:09 David S Gathright
  0 siblings, 0 replies; 3+ messages in thread
From: David S Gathright @ 2003-08-30  8:09 UTC (permalink / raw)
  To: help-gnats

Greetings.

At our organization, we've been using GNATS to track issues with some of
the various forms of software we hack up.  The GNATS system is almost
completely internal (i.e. we don't have a help line nor outside users
using this system).  We're on the verge of installing the new 4.0 system
in order to take advantage of its extensibility and flexibility.  

One thing that could be added that would make GNATS even more powerful
(as far as Quality Assurance is concerned), would be to include a
mechanism for certain users to approve changes before they are made. 
This person(s) may also be the only ones responsible/able to close PRs.

This would be easily done by adding "Approval-Date" and "Approved-By"
fields, but letting only certain individuals edit those fields is more
difficult (at least, as far as I know), especially as these might be
different from DB to DB.  Even more complicated is the case where you
have to get multiple people to approve the fix.

I wonder if there isn't a way to do this that I am overlooking, or if
this has been considered for future development purposes?

Thanks!

David Gathright

PS:  I have to admit, with the new GNATS 4.0 system, in addition to
using the software for our software PTS, I'm also pushing the system in
new directions to give us a web-based tool to manage just about any
typical form we use.  For example, we have various types of "Change
Request" forms for non-software tools (i.e. move this table over there),
which would be much simpler to manage using a GNATS-like system. 
However, in our applications (which are much more critical than moving
tables, BTW), we require a number of different people to sign off on the
change before it can be done.  Having this feature in GNATS would help
in this application, too.

-- 
David S Gathright  (David.Gathright@lasp.colorado.edu)
Flight Software Engineer
Laboratory for Atmospheric and Space Physics
University of Colorado  (http://lasp.colorado.edu)
Office: (303) 492-7997  


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-25 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24 18:20 Adding "Approval" Mechanism Pankaj Garg
  -- strict thread matches above, loose matches on Subject: below --
2004-11-25 17:22 Andrew Kemp
2003-08-30  8:09 David S Gathright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).