aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Wallet/Admin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl/lib/Wallet/Admin.pm')
-rw-r--r--perl/lib/Wallet/Admin.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm
index 29b2f21..b07c7d1 100644
--- a/perl/lib/Wallet/Admin.pm
+++ b/perl/lib/Wallet/Admin.pm
@@ -98,13 +98,22 @@ sub initialize {
$self->default_data;
# Create a default admin ACL.
- my $acl = Wallet::ACL->create ('ADMIN', $self->{schema}, $user,
- 'localhost');
- unless ($acl->add ('krb5', $user, $user, 'localhost')) {
- $self->error ($acl->error);
+ eval {
+ my $guard = $self->{schema}->txn_scope_guard;
+ $self->{schema}->resultset ('Acl')->populate ([
+ [ qw/ac_id ac_name/ ],
+ [ 1, 'ADMIN' ],
+ ]);
+ $self->{schema}->resultset ('AclEntry')->populate ([
+ [ qw/ae_id ae_scheme ae_identifier/ ],
+ [ 1, 'krb5', $user ],
+ ]);
+ $guard->commit;
+ };
+ if ($@) {
+ $self->error ("cannot add ADMIN ACL: $@");
return;
}
-
return 1;
}