X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_right.pm;h=aca8c78dbba3bd23fc20d9dc0bfc26bfa63d1850;hb=ba10db86bf541ac72be47de1e9aa5e7d43dc29b6;hp=815c6d9bdd91fdb238e2b0d8113bb2ce5cc02f44;hpb=00cb3b1291e336dedd28c5326bc210e5e511c337;p=freeside.git diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm index 815c6d9bd..aca8c78db 100644 --- a/FS/FS/access_right.pm +++ b/FS/FS/access_right.pm @@ -2,7 +2,10 @@ package FS::access_right; use strict; use vars qw( @ISA ); +use Tie::IxHash; use FS::Record qw( qsearch qsearchs ); +use FS::upgrade_journal; +use FS::access_group; @ISA = qw(FS::Record); @@ -182,10 +185,57 @@ sub _upgrade_data { # class method my @all_groups = qsearch('access_group', {}); - my %onetime = ( - 'List customers' => 'List all customers', - 'List packages' => 'Summarize packages', - ); + tie my %onetime, 'Tie::IxHash', + 'List customers' => 'List all customers', + 'List all customers' => 'Advanced customer search', + 'List packages' => 'Summarize packages', + 'Post payment' => 'Backdate payment', + 'Cancel customer package immediately' => 'Un-cancel customer package', + 'Suspend customer package' => 'Suspend customer', + 'Unsuspend customer package' => 'Unsuspend customer', + 'Post credit' => 'Credit line items', + #'View customer tax exemptions' => 'Edit customer tax exemptions', + 'Edit customer' => 'Edit customer tax exemptions', + 'Edit package definitions' => 'Bulk edit package definitions', + + 'List services' => [ 'Services: Accounts', + 'Services: Domains', + 'Services: Certificates', + 'Services: Mail forwards', + 'Services: Virtual hosting services', + 'Services: Wireless broadband services', + 'Services: DSLs', + 'Services: Dish services', + 'Services: Hardware', + 'Services: Phone numbers', + 'Services: PBXs', + 'Services: Ports', + 'Services: Mailing lists', + 'Services: External services', + ], + + 'Services: Accounts' => 'Services: Accounts: Advanced search', + 'Services: Wireless broadband services' => 'Services: Wireless broadband services: Advanced search', + 'Services: Hardware' => 'Services: Hardware: Advanced search', + 'Services: Phone numbers' => 'Services: Phone numbers: Advanced search', + + 'List rating data' => [ 'Usage: RADIUS sessions', + 'Usage: Call Detail Records (CDRs)', + 'Usage: Unrateable CDRs', + ], + + 'Edit customer' => [ 'Edit customer basics', + 'Edit customer addresses', + 'Edit customer contacts', + ], + + 'Provision customer service' => [ 'Edit password' ], + + 'Financial reports' => [ 'Employees: Commission Report', + 'Employees: Audit Report', + ], + 'Services: Accounts' => 'Services: Cable Subscribers', +; foreach my $old_acl ( keys %onetime ) { @@ -195,20 +245,20 @@ sub _upgrade_data { # class method foreach my $new_acl ( @new_acl ) { - ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/ /_/g; + ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/\W/_/g; next if FS::upgrade_journal->is_done($journal); # grant $new_acl to all groups who have $old_acl for my $group (@all_groups) { - if ( $group->access_right($old_acl) ) { - my $access_right = FS::access_right->new( { - 'righttype' => 'FS::access_group', - 'rightobjnum' => $group->groupnum, - 'rightname' => $new_acl, - } ); - my $error = $access_right->insert; - die $error if $error; - } + next unless $group->access_right($old_acl); + next if $group->access_right($new_acl); + my $access_right = FS::access_right->new( { + 'righttype' => 'FS::access_group', + 'rightobjnum' => $group->groupnum, + 'rightname' => $new_acl, + } ); + my $error = $access_right->insert; + die $error if $error; } FS::upgrade_journal->set_done($journal); @@ -228,7 +278,7 @@ sub _upgrade_data { # class method 'rightname' => 'Download report data', } ); my $error = $access_right->insert; - die $error if $error; + warn $error if $error; } FS::upgrade_journal->set_done('ACL_download_report_data');