diff options
-rw-r--r-- | FS/FS/Setup.pm | 33 | ||||
-rwxr-xr-x | FS/bin/freeside-setup | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/FS/FS/Setup.pm b/FS/FS/Setup.pm index 8e89be5eb..c53fe65b4 100644 --- a/FS/FS/Setup.pm +++ b/FS/FS/Setup.pm @@ -48,6 +48,8 @@ sub create_initial_data { #initial_data data populate_initial_data(%opt); + populate_access(); + populate_msgcat(); if ( $oldAutoCommit ) { @@ -131,6 +133,11 @@ sub initial_data { #tie my %hash, 'Tie::DxHash', tie my %hash, 'Tie::IxHash', + #superuser group + 'access_group' => [ + { 'groupname' => 'Superuser' }, + ], + #billing events 'part_bill_event' => [ { 'payby' => 'CARD', @@ -282,6 +289,32 @@ sub initial_data { } +sub populate_access { + + use FS::AccessRight; + use FS::access_right; + + foreach my $rightname ( FS::AccessRight->rights ) { + my $access_right = new FS::access_right { + 'righttype' => 'FS::access_group', + 'rightobjnum' => 1, #$supergroup->groupnum, + 'rightname' => $rightname, + }; + my $ar_error = $access_right->insert; + die $ar_error if $ar_error; + } + + #foreach my $agent ( qsearch('agent', {} ) ) { + my $access_groupagent = new FS::access_groupagent { + 'groupnum' => $supergroup->groupnum, + 'agentnum' => 1, #$agent->agentnum, + }; + my $aga_error = $access_groupagent->insert; + die $aga_error if $aga_error; + #} + +} + sub populate_msgcat { use FS::Record qw(qsearch); diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 9f87f10b7..138011430 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -7,6 +7,7 @@ use strict; use vars qw($opt_s $opt_d $opt_v); use Getopt::Std; use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); +use FS::CurrentUser; use FS::Schema qw( dbdef_dist reload_dbdef ); use FS::Record; #use FS::raddb; @@ -85,6 +86,7 @@ $dbdef->save($dbdef_file); # create 'em ### +$FS::CurrentUser::upgrade_hack = 1; my $dbh = adminsuidsetup $user; #create tables |