-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsync_LDAPGroups.pl
More file actions
executable file
·50 lines (39 loc) · 1.14 KB
/
sync_LDAPGroups.pl
File metadata and controls
executable file
·50 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl -w
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
#
# Script to syncronize group members with LDAP on an ad-hoc basis
#
use strict;
use warnings;
use lib qw(. lib);
use Bugzilla;
BEGIN { Bugzilla->extensions }
use Bugzilla::Extension::LDAPGroups::Util qw(sync_ldap);
# Get all groups where the ldap_dn has been set
sub get_groups_using_ldap_dn(){
my @groups = Bugzilla::Group->get_all;
my @groups_with_ldap_dn;
foreach my $group (@groups){
if ($group->ldap_dn){
push @groups_with_ldap_dn, $group;
}
}
return @groups_with_ldap_dn;
}
sub main(){
my @groups = get_groups_using_ldap_dn();
# For every group that has a ldap_dn update
# the groups' members according to LDAP
foreach my $group (@groups){
sync_ldap($group);
}
return;
}
main();