initial commit of file from CVS for e-smith-ibays on Wed 12 Jul 08:56:45 BST 2023
This commit is contained in:
30
root/etc/e-smith/events/actions/group-ibay-modify
Executable file
30
root/etc/e-smith/events/actions/group-ibay-modify
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::event;
|
||||
|
||||
my $accounts = esmith::AccountsDB->open() or
|
||||
die "Unable to open accounts db: $!";
|
||||
|
||||
my ($self, $groupName) = @ARGV;
|
||||
|
||||
# Find all "i-bay" entries in the e-smith accounts database and
|
||||
# if the group matches this one, change it to group "admin".
|
||||
|
||||
my @modified_ibays;
|
||||
foreach my $ibay ( $accounts->ibays ) {
|
||||
if ( $ibay->prop('Group') eq $groupName ) {
|
||||
$ibay->set_prop( 'Group', 'admin' );
|
||||
push @modified_ibays, $ibay->key;
|
||||
event_signal("ibay-modify-files", $ibay->key) or
|
||||
die ("Error occurred while updating i-bay.\n");
|
||||
}
|
||||
}
|
||||
|
||||
my $count = @modified_ibays;
|
||||
if ( $count > 0 ) {
|
||||
event_signal("ibay-modify-servers" ) or
|
||||
die ("Error occurred after updating i-bays.\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user