Hi,

We've been successfully using scmbug with Bugzilla 3.6 since it's been
released (after a bit patching). However I haven't used version tagging in
production.
Anyway - I've just tested that feature and I have a patch for it (attached)
which seems to resolve the problem in my test environment.

(Error messages are still a bit ambiguous on error /whatever fails always
Integration.pm reports that no product exists with such name/).

Best regards,
Yavor

On Wed, May 5, 2010 at 06:58, Kristis Makris <[email protected]> wrote:

> Hi Michal,
>
> Thanks for reporting this.
>
> http://bugzilla.mkgnu.net/show_bug.cgi?id=1473
>
> Scmbug does not support Bugzilla 3.6 yet. Personally I have not tested
> it against 3.6, although I wonder if Yavor, who has ran Scmbug against
> Bugzilla 3.6 might be able to provide some insight.
>
> On Tue, 2010-05-04 at 09:59 +0200, Michal Kašpar wrote:
> > Error.pm:102:Bugzilla::Error::_throw_error - You are not allowed to
> > edit properties of product 'TestProduct'.
> > I haven't found where scmbug "authenticates" with BZ when branching.
>
> I think that's really the issue. Some sort of logic like:
>
> my $userid = Bugzilla::User::login_to_id( $username );
>
> is definitely missing from the routines that handle tagging.
>
>
diff -Naur old/Bugzilla.pm patched/Bugzilla.pm
--- old/Bugzilla.pm	2010-04-19 00:38:46.000000000 +0300
+++ patched/Bugzilla.pm	2010-05-05 10:34:15.000000000 +0300
@@ -1216,7 +1216,7 @@
 # - 1 if the product name does not exist
 sub integration_add_tag {
     my $self = shift;
-    my ( $product_name, $tag_name, $description ) = ( @_ );
+    my ( $product_name, $tag_name, $description, $username ) = ( @_ );
     my $sql;
 
     if ( $self->is_version_up_to_2_16() ) {
@@ -1247,13 +1247,19 @@
 	SendSQL( $sql );
 	PopGlobalSQLState();
     } else {
-	my $product = new Bugzilla::Product( { name => $product_name } );
-
-        if( !defined ( $product ) ) {
-            # The product name does not exist
-            return 1;
+	eval { 
+		my $user = Bugzilla::User->check( $username );
+		Bugzilla->set_user( $user );
+		my $product = $user->check_can_admin_product( $product_name );
+		my $version = Bugzilla::Version->create( { name => $tag_name, product => $product } );
+	}; # eval
+	if ( $@ ) {
+		my $err = $@;
+		log_daemon_warn( undef, $err );
+		my $dbh = Bugzilla->dbh;
+		$dbh->bz_rollback_transaction() if $dbh->bz_in_transaction();
+		return 1;
         }
-	my $version = Bugzilla::Version::create( $tag_name, $product );
     }
 
     $self->execute_post_tag_cleanup();
diff -Naur old/Integration.pm patched/Integration.pm
--- old/Integration.pm	2010-04-19 00:30:06.000000000 +0300
+++ patched/Integration.pm	2010-05-05 09:59:01.000000000 +0300
@@ -309,7 +309,8 @@
 	    # This tag does not exist already for this product. Add it
 	    $ret = $self->bugtracker()->integration_add_tag( $self->request()->{ product_name },
 							     $self->request()->{ type }->{ tag }->{ name },
-							     $self->request()->{ original_log_message } );
+							     $self->request()->{ original_log_message },
+							     $self->request()->{ translated_username } );
 	    
             # Apply policy valid_product_name
             if ( $self->request()->{ policies }->{ valid_product_name }->{ enabled } ) {
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to