X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_user.pm;h=44d3beec1c197f521d12a113b20dde465d2f78a5;hb=96623c3c471fda6935bd57efeaa0ad484285b74b;hp=c938474a625aa40f8e98e0e9f144400f8c15e714;hpb=2e7ce01632012ccc0dd440a8bc37a9ec9bd55fac;p=freeside.git diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index c938474a6..44d3beec1 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -1,14 +1,12 @@ package FS::access_user; +use base qw( FS::m2m_Common FS::option_Common ); use strict; -use base qw( FS::m2m_Common FS::option_Common ); -use vars qw( $DEBUG $me $conf ); +use vars qw( $DEBUG $me ); use FS::UID; use FS::Auth; use FS::Conf; use FS::Record qw( qsearch qsearchs dbh ); -use FS::access_user_pref; -use FS::access_usergroup; use FS::agent; use FS::cust_main; use FS::sales; @@ -42,17 +40,37 @@ inherits from FS::Record. The following fields are currently supported: =over 4 -=item usernum - primary key +=item usernum + +primary key + +=item username + +=item _password + +=item _password_encoding + +Empty or bcrypt + +=item last + +Last name -=item username - +=item first -=item _password - +First name -=item last - +=item user_custnum -=item first - +Master customer for this employee (for commissions) -=item disabled - empty or 'Y' +=item report_salesnum + +Default sales person for this employee (for reports) + +=item disabled + +Empty or 'Y' =back @@ -265,29 +283,6 @@ sub report_sales { Returns links to the the groups this user is a part of, as FS::access_usergroup objects (see L). -=cut - -sub access_usergroup { - my $self = shift; - qsearch( 'access_usergroup', { 'usernum' => $self->usernum } ); -} - -#=item access_groups -# -#=cut -# -#sub access_groups { -# -#} -# -#=item access_groupnames -# -#=cut -# -#sub access_groupnames { -# -#} - =item agentnums Returns a list of agentnums this user can view (via group membership). @@ -401,6 +396,7 @@ sub agents { 'table' => 'agent', 'hashref' => { disabled=>'' }, 'extra_sql' => ' AND '. $self->agentnums_sql(@_), + 'order_by' => 'ORDER BY agent', }); } @@ -428,7 +424,7 @@ sub access_right { unless ( grep !exists($self->{_ACLcache}{$_}), @$rightname ) { warn "$me ACL cache hit for ". join(', ', @$rightname). "\n" if $DEBUG; - return grep $self->{_ACLcache}{$_}, @$rightname + return scalar( grep $self->{_ACLcache}{$_}, @$rightname ); } warn "$me ACL cache miss for ". join(', ', @$rightname). "\n" @@ -480,7 +476,7 @@ sub default_customer_view { my $self = shift; $self->option('default_customer_view') - || $conf->config('cust_main-default_view') + || FS::Conf->new->config('cust_main-default_view') || 'basics'; #s/jumbo/basics/ starting with 3.0 } @@ -515,7 +511,7 @@ sub spreadsheet_format { my $f = $override || $self->option('spreadsheet_format') - || $conf->config('spreadsheet_format') + || FS::Conf->new->config('spreadsheet_format') || 'XLS'; $formats{$f}; @@ -537,6 +533,7 @@ sub is_system_user { fs_signup fs_bootstrap fs_selfserv + fs_api ) ); }