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

Annotation 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.1 - (hide annotations) (download)
Mon Feb 25 22:51:53 2008 UTC (16 years, 8 months ago) by snetram
Branch: MAIN
CVS Tags: smeserver-subversion-1_4-5_el4_sme, smeserver-subversion-1_4-2_el4_sme, smeserver-subversion-1_4-4_el4_sme, smeserver-subversion-1_4-3_el4_sme
* Mon Feb 25 2008 Jonathan Martens <smeserver-contribs@snetram.nl>
- 1.4-3
- Add hooks to user-delete and group-delete event [SME: 3981]
- Remove subversion-delete event since it is and should not be used [SME: 3982]
- Improve sanity check on repository-delete event [SME: 3983]

1 snetram 1.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,56 @@
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 ($userName);
20     +
21     +if ($event eq 'user-delete') {
22     +
23     + my @entries = qw(UsersWrite UsersRead);
24     +
25     +} elsif ($event eq 'group-delete') {
26     +
27     + my @entries = qw(GroupsWrite GroupsRead);
28     +
29     +} else {
30     +
31     + die "Invalid event: $event";
32     +
33     +}
34     +
35     +use esmith::AccountsDB;
36     +
37     +my $db_accounts = esmith::AccountsDB->open_ro() or
38     + die "Couldn't open AccountsDB\n";
39     +
40     +my @repositories = $db_accounts->get_all_by_prop('type' => 'repository');
41     +
42     +REPOSITORY: foreach my $repository (
43     + (@repositories),
44     +)
45     +{
46     + my $repository_rec = $db_accounts->get($repository) || next REPOSITORY;
47     +
48     + foreach my $entry (@entries) {
49     +
50     + my $members = $repository_rec->prop($entry);
51     + my @members = split (/,/, $members);
52     + @members = grep (!/^$item$/, @members);
53     + $repository_rec->set_prop($entry, join(',', @members));
54     +
55     + }
56     +
57     +}
58     +
59     +exit(0);

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