[freeside-commits] freeside/FS/FS AccessRight.pm, 1.51, 1.52 access_user.pm, 1.26, 1.27
Ivan,,,
ivan at wavetail.420.am
Wed Jun 16 19:08:54 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv17396/FS/FS
Modified Files:
AccessRight.pm access_user.pm
Log Message:
Add "View customers of all agents" access rights, RT#7010
Index: access_user.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/access_user.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -d -r1.26 -r1.27
--- access_user.pm 29 Mar 2010 00:23:07 -0000 1.26
+++ access_user.pm 17 Jun 2010 02:08:52 -0000 1.27
@@ -1,20 +1,16 @@
package FS::access_user;
use strict;
-use vars qw( @ISA $DEBUG $me $conf $htpasswd_file );
+use base qw( FS::m2m_Common FS::option_Common );
+use vars qw( $DEBUG $me $conf $htpasswd_file );
use FS::UID;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
-use FS::m2m_Common;
-use FS::option_Common;
use FS::access_user_pref;
use FS::access_usergroup;
use FS::agent;
use FS::cust_main;
- at ISA = qw( FS::m2m_Common FS::option_Common FS::Record );
-#@ISA = qw( FS::m2m_Common FS::option_Common );
-
$DEBUG = 0;
$me = '[FS::access_user]';
@@ -367,6 +363,11 @@
Optional table name in which agentnum is being checked. Sometimes required to
resolve 'column reference "agentnum" is ambiguous' errors.
+=item viewall_right
+
+All agents will be viewable if the current user has the provided access right.
+Defaults to 'View customers of all agents'.
+
=back
=cut
@@ -377,16 +378,21 @@
my $agentnum = $opt{'table'} ? $opt{'table'}.'.agentnum' : 'agentnum';
-# my @agentnums = map { "$agentnum = $_" } $self->agentnums;
- my @agentnums = ();
- push @agentnums, "$agentnum IN (". join(',', $self->agentnums). ')';
+ my @or = ();
- push @agentnums, "$agentnum IS NULL"
+ my $viewall_right = $opt{'viewall_right'} || 'View customers of all agents';
+ if ( $self->access_right($viewall_right) ) {
+ push @or, "$agentnum IS NOT NULL";
+ } else {
+ push @or, "$agentnum IN (". join(',', $self->agentnums). ')';
+ }
+
+ push @or, "$agentnum IS NULL"
if $opt{'null'}
|| ( $opt{'null_right'} && $self->access_right($opt{'null_right'}) );
- return ' 1 = 0 ' unless scalar(@agentnums);
- '( '. join( ' OR ', @agentnums ). ' )';
+ return ' 1 = 0 ' unless scalar(@or);
+ '( '. join( ' OR ', @or ). ' )';
}
Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -w -d -r1.51 -r1.52
--- AccessRight.pm 20 May 2010 22:48:42 -0000 1.51
+++ AccessRight.pm 17 Jun 2010 02:08:52 -0000 1.52
@@ -115,6 +115,7 @@
{ rightname=>'Delete customer', desc=>"Enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customer's packages if they cancel service." }, #aka. deletecustomers
'Bill customer now', #NEW
'Bulk send customer notices', #NEW
+ { rightname=>'View customers of all agents', global=>1 },
],
###
@@ -249,6 +250,8 @@
'Billing event reports',
'Receivables report',
'Financial reports',
+
+ #{ rightname => 'List customers of all agents', global=>1 },
],
###
@@ -294,6 +297,9 @@
{ rightname=>'Broadband configuration' },
{ rightname=>'Broadband global configuration', global=>1 },
+ #{ rightname=>'Edit employees', global=>1, },
+ #{ rightname=>'Edit employee groupss', global=>1, },
+
{ rightname=>'Configuration', global=>1 }, #most of the rest of the configuraiton is not agent-virtualized
{ rightname=>'Configuration download', }, #description of how it affects
More information about the freeside-commits
mailing list