help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restricting close PR


From: Mel Hatzis
Subject: Re: restricting close PR
Date: Fri, 18 Feb 2005 20:57:33 -0800
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

McFarland, Ken wrote:
> Jim,
>  
> Without making perl change in gnatsweb.pl I don't think thing there is
> support for this today.   However, you could do something like this in your
> dbconfig file.  It's not pretty, but would probably work....but you'll
> need to keep an updated list of people not allowed to close a PR in
> here  (not
> a great solution)  I don't to this exactly, but do change other fields
> based on certain state changes.  I didn't try this, but tweaked mine a
> bit for
> this example.... I think this would work for you to block say user
> kmcfarla from closing a PR.
>  
> fwiw
>  
> field "State" {
>     builtin-name "state"
>     description "The current state of the PR"
>     enumerated-in-file {
>         path "states"
>         fields { "state" "type" "description" }
>         key "state"
>         default "open"
>     }
>     textsearch
>  
>     on-change {
>         # Add Audit-Trail entries when this field changes.
>         add-audit-trail
>         # Require that a reason be supplied when this field is edited.
>         require-change-reason
>     }
>  
> 
>     #
>     # Change State back to its original setting for the following users
> aren't allowed to Close a PR
>     #
>     on-change "(oldpr:State[type]==\"open\") & (Originator==\"kmcfarla\")" {
>  
>                 set-field "State" {
>                         oldpr:State
>                 }
>     }
> }


Actually, a better way to do this would be to extend the set of metadata
fields in the responsible file with an additional datapoint...call it
the 'allowed-to-close' field. So your responsible file would look
something like:

gnats-admin:GNATS administrator:address@hidden:N
foo:Foo User:address@hidden:N
bar:Bar User:address@hidden:Y
baz:Baz User:address@hidden:N
etc.

You'll need to tweak your dbconfig file and update the definition of
the 'Responsible' field along these lines too.

Once you've done this, you can use the following type of on-change
clause:

   on-change "(oldpr:state[type]==\"open\") &\
              (state[type]==\"closed\") &\
              (responsible[allowed-to-close]==\"N\")" {
                  set-field "State" { "%s" "$OldValue" }
              }

Note that I haven't tested this, but it ought to work.
Let me know if you have trouble with it.

--
Mel Hatzis

> 
>     -----Original Message-----
>     *From:* address@hidden
>     [mailto:address@hidden
>     Behalf Of *Jim Prowak
>     *Sent:* Wednesday, February 16, 2005 9:17 AM
>     *To:* address@hidden
>     *Subject:* restricting close PR
> 
> 
>     With gnats-web, is there a way to restrict the ability to close PRs
>     to a certain user?
> 
>     thanks,
> 
>     Jim
>     
> --------------------------------------------------------------------------------------------
>     Jim Prowak                                                          
>     Voice(585) 899-4306  
>     National Semiconductor                                      Fax
>     (585) 899-4320    
>     1000 Pittsford-Victor Rd.
>     Pittsford, N.Y. 14534    
>     address@hidden
>     
> --------------------------------------------------------------------------------------------
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Help-gnats mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gnats





reply via email to

[Prev in Thread] Current Thread [Next in Thread]