[Mageia-webteam] [Bug 899] Synchronize bugzilla groups with ldap groups

Michael Scherer bugzilla-daemon at mageia.org
Wed Apr 20 02:06:19 CEST 2011


https://bugs.mageia.org/show_bug.cgi?id=899

--- Comment #9 from Michael Scherer <misc at zarb.org> 2011-04-20 02:06:19 UTC ---
In fact, I did some scripting, and I do not see how to change the group of a
user using the API ( ie, using ->set() :

use strict;
use warnings;
use lib "/usr/share/bugzilla/lib/";
use Bugzilla;
use Bugzilla::User;
use Bugzilla::Group;
my $user = new Bugzilla::User( Bugzilla::User::login_to_id($ARGV[0]));
print "Id : ". $user->id . "\n";
print "Name : " . $user->name . "\n";
for my $g ( @{$user->groups()} ) {
        print "Group : " . $g->name . "\n";
}
my $admin_group = Bugzilla::Group->match( { 'name' => 'admin' })->[0];

push(@{$user->{'groups'}}, $admin_group);
print Data::Dumper::Dumper($user);
print "$user \n";
$user->update();

I guess for group manipulation, it doesn't work with our version without
fiddling with sql directly.

-- 
Configure bugmail: https://bugs.mageia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Mageia-webteam mailing list