/[smecontribs]/rpms/smeserver-subversion/contribs7/smeserver-subversion-1.4-AddHooksToUSerAndGroupDeleteEvents.patch
ViewVC logotype

Contents of /rpms/smeserver-subversion/contribs7/smeserver-subversion-1.4-AddHooksToUSerAndGroupDeleteEvents.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Sun Nov 23 04:58:11 2008 UTC (15 years, 11 months ago) by slords
Branch: MAIN
Changes since 1.2: +0 -0 lines
FILE REMOVED
Part of epel

1 --- smeserver-subversion-1.4/root/etc/e-smith/events/actions/subversion-delete-from-access-list.AddHooksToUSerAndGroupDeleteEvents 2008-02-25 22:28:36.000000000 +0100
2 +++ smeserver-subversion-1.4/root/etc/e-smith/events/actions/subversion-delete-from-access-list 2008-02-25 22:27:32.000000000 +0100
3 @@ -0,0 +1,58 @@
4 +#!/usr/bin/perl -w
5 +
6 +package esmith;
7 +
8 +use strict;
9 +use Errno;
10 +use esmith::util;
11 +
12 +my $event = $ARGV [0];
13 +my $item = $ARGV [1];
14 +
15 +#------------------------------------------------------------
16 +# Delete the user from subversion repositories
17 +#------------------------------------------------------------
18 +
19 +die "Username argument missing." unless defined ($item);
20 +
21 +my @entries = qw();
22 +
23 +if ($event eq 'user-delete') {
24 +
25 + @entries = qw(UsersWrite UsersRead);
26 +
27 +} elsif ($event eq 'group-delete') {
28 +
29 + @entries = qw(GroupsWrite GroupsRead);
30 +
31 +} else {
32 +
33 + die "Invalid event: $event";
34 +
35 +}
36 +
37 +use esmith::AccountsDB;
38 +
39 +my $db_accounts = esmith::AccountsDB->open_ro() or
40 + die "Couldn't open AccountsDB\n";
41 +
42 +my @repositories = $db_accounts->get_all_by_prop('type' => 'repository');
43 +
44 +REPOSITORY: foreach my $repository (
45 + (@repositories),
46 +)
47 +{
48 + my $repository_rec = $db_accounts->get($repository) || next REPOSITORY;
49 +
50 + foreach my $entry (@entries) {
51 +
52 + my $members = $repository_rec->prop($entry);
53 + my @members = split (/,/, $members);
54 + @members = grep (!/^$item$/, @members);
55 + $repository_rec->set_prop($entry, join(',', @members));
56 +
57 + }
58 +
59 +}
60 +
61 +exit(0);

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed