summaryrefslogtreecommitdiff
path: root/FS/FS/Record.pm
diff options
context:
space:
mode:
authorivan <ivan>2009-01-25 23:58:25 +0000
committerivan <ivan>2009-01-25 23:58:25 +0000
commitdae1d4ab33e5aee1ca8fcba89c8cf4ce4cbd1810 (patch)
tree7458d47a090fda50c0743363a15341a0890e9416 /FS/FS/Record.pm
parent8433fdfe8afdd155ff5e8725ccf98612d4c36cad (diff)
fix one-time charges and package customization for employees who don't have 'Edit global package definition' ACL, RT#4668
Diffstat (limited to 'FS/FS/Record.pm')
-rw-r--r--FS/FS/Record.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index b53c333..b856aea 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2326,15 +2326,18 @@ sub ut_foreign_keyn {
: '';
}
-=item ut_agentnum_acl
+=item ut_agentnum_acl COLUMN [ NULL_RIGHT | NULL_RIGHT_LISTREF ]
Checks this column as an agentnum, taking into account the current users's
-ACLs.
+ACLs. NULL_RIGHT or NULL_RIGHT_LISTREF, if specified, indicates the access
+right or rights allowing no agentnum.
=cut
sub ut_agentnum_acl {
- my( $self, $field, $null_acl ) = @_;
+ my( $self, $field ) = (shift, shift);
+ my $null_acl = scalar(@_) ? shift : [];
+ $null_acl = [ $null_acl ] unless ref($null_acl);
my $error = $self->ut_foreign_keyn($field, 'agent', 'agentnum');
return "Illegal agentnum: $error" if $error;
@@ -2349,7 +2352,7 @@ sub ut_agentnum_acl {
} else {
return "Access denied"
- unless $curuser->access_right($null_acl);
+ unless grep $curuser->access_right($_), @$null_acl;
}