4 # useradmin_create_user(&details)
5 # Sets quotas on chosen filesystems
6 sub useradmin_create_user
8 local ($anysync) = grep { /^sync_/ } (keys %config);
10 local ($k, $fs, $i, %fslist);
11 foreach $fs (&list_filesystems()) {
12 if ($fs->[4] && $fs->[5]) {
16 foreach $k (keys %config) {
17 if ($k =~ /^sync_(\S+)$/ && $fslist{$1}) {
18 # found a filesystem to set quotas on
20 @quot = split(/\s+/, $config{$k});
21 &edit_user_quota($_[0]->{'user'}, $fs, @quot);
26 # useradmin_delete_user(&details)
27 # Zero the quotas of a deleted user
28 sub useradmin_delete_user
30 foreach $fs (&list_filesystems()) {
31 if ($fs->[4] && $fs->[5]) {
35 $n = &user_filesystems($_[0]->{'user'});
36 for($i=0; $i<$n; $i++) {
37 $f = $filesys{$i,'filesys'};
39 # user has quota, and filesystem is local
40 &edit_user_quota($_[0]->{'user'}, $f, 0, 0, 0, 0);
45 # useradmin_modify_user(&details)
46 # Quotas are stored by UID, so no need to change anything
47 # when a username changes.
48 sub useradmin_modify_user
50 # XXX should change if UID changes?
54 # useradmin_create_group(&details)
55 # Sets quotas on chosen filesystems
56 sub useradmin_create_group
58 local ($anysync) = grep { /^gsync_/ } (keys %config);
59 return if (!$anysync);
60 return if (!defined(&edit_group_quota) || !defined(&group_filesystems));
61 local ($k, $fs, $i, %fslist);
62 foreach $fs (&list_filesystems()) {
63 if ($fs->[4] && $fs->[5]) {
67 foreach $k (keys %config) {
68 if ($k =~ /^gsync_(\S+)$/ && $fslist{$1}) {
69 # found a filesystem to set quotas on
71 @quot = split(/\s+/, $config{$k});
72 &edit_group_quota($_[0]->{'group'}, $fs, @quot);
77 # useradmin_delete_group(&details)
78 # Zero the quotas of a deleted group
79 sub useradmin_delete_group
81 return if (!defined(&edit_group_quota) || !defined(&group_filesystems));
82 foreach $fs (&list_filesystems()) {
83 if ($fs->[4] && $fs->[5]) {
87 $n = &group_filesystems($_[0]->{'group'});
88 for($i=0; $i<$n; $i++) {
89 $f = $filesys{$i,'filesys'};
91 # group has quota, and filesystem is local
92 &edit_group_quota($_[0]->{'group'}, $f, 0, 0, 0, 0);
97 # useradmin_modify_group(&details)
98 # Quotas are stored by UID, so no need to change anything
99 # when a group name changes.
100 sub useradmin_modify_group
102 return if (!defined(&edit_group_quota) || !defined(&group_filesystems));
103 # XXX should change if UID changes?