diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-04-04 15:50:23 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-04-04 15:50:23 -0700 |
| commit | 9e710a89ff6b8a1e6b0dc407e7522390dc168079 (patch) | |
| tree | 734979ad7b172c506fa3b24c90cc6edb83255e47 | |
| parent | 685f35c0d8d08ea7bbf2ac7cf2db19cdc79fcccf (diff) | |
add "Summarize packages" ACL, RT#16534
| -rw-r--r-- | FS/FS/access_right.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm index d2a39aac8..341055bfc 100644 --- a/FS/FS/access_right.pm +++ b/FS/FS/access_right.pm @@ -182,23 +182,30 @@ sub _upgrade_data { # class method my @all_groups = qsearch('access_group', {}); - ### ACL_list_all_customers - if ( !FS::upgrade_journal->is_done('ACL_list_all_customers') ) { + my %onetime = ( + 'List customers' => 'List all customers', + 'List packages' => 'Summarize packages', + ); + + foreach my $old_acl ( keys %onetime ) { + my $new_acl = $onetime{$old_acl}; #support arrayref too? + ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/ /_/g; + next if FS::upgrade_journal->is_done($journal); - # grant "List all customers" to all users who have "List customers" + # grant $new_acl to all groups who have $old_acl for my $group (@all_groups) { - if ( $group->access_right('List customers') ) { + if ( $group->access_right($old_acl) ) { my $access_right = FS::access_right->new( { 'righttype' => 'FS::access_group', 'rightobjnum' => $group->groupnum, - 'rightname' => 'List all customers', + 'rightname' => $new_acl, } ); my $error = $access_right->insert; die $error if $error; } } - FS::upgrade_journal->set_done('ACL_list_all_customers'); + FS::upgrade_journal->set_done($journal); } ### ACL_download_report_data |
