10 sub userinfo_retrieve () { #{{{
11 my $userinfo=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
15 sub userinfo_store ($) { #{{{
18 my $oldmask=umask(077);
19 my $ret=Storable::lock_store($userinfo, "$config{wikistatedir}/userdb");
24 sub userinfo_get ($$) { #{{{
28 my $userinfo=userinfo_retrieve();
29 if (! defined $userinfo ||
30 ! exists $userinfo->{$user} || ! ref $userinfo->{$user} ||
31 ! exists $userinfo->{$user}->{$field}) {
34 return $userinfo->{$user}->{$field};
37 sub userinfo_set ($$$) { #{{{
42 my $userinfo=userinfo_retrieve();
43 if (! defined $userinfo ||
44 ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) {
48 $userinfo->{$user}->{$field}=$value;
49 return userinfo_store($userinfo);
52 sub userinfo_setall ($$) { #{{{
56 my $userinfo=userinfo_retrieve();
57 if (! defined $userinfo) {
60 $userinfo->{$user}=$info;
61 return userinfo_store($userinfo);
64 sub is_admin ($) { #{{{
67 return grep { $_ eq $user_name } @{$config{adminuser}};
70 sub get_banned_users () { #{{{
72 my $userinfo=userinfo_retrieve();
73 foreach my $user (keys %{$userinfo}) {
74 push @ret, $user if $userinfo->{$user}->{banned};
79 sub set_banned_users (@) { #{{{
80 my %banned=map { $_ => 1 } @_;
81 my $userinfo=userinfo_retrieve();
82 foreach my $user (keys %{$userinfo}) {
83 $userinfo->{$user}->{banned} = $banned{$user};
85 return userinfo_store($userinfo);
88 sub commit_notify_list ($@) { #{{{
92 foreach my $file (@_) {
93 push @pages, grep { $pagesources{$_} eq $file } keys %pagesources;
97 my $userinfo=userinfo_retrieve();
98 foreach my $user (keys %{$userinfo}) {
99 next if $user eq $committer;
100 if (exists $userinfo->{$user}->{subscriptions} &&
101 length $userinfo->{$user}->{subscriptions} &&
102 exists $userinfo->{$user}->{email} &&
103 length $userinfo->{$user}->{email} &&
104 grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}) } @pages) {
105 push @ret, $userinfo->{$user}->{email};