X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Faccess_user.pm;h=075733a6861a0cfecfef4732607f096eb8d83bb2;hp=25aa8af01420a8dac5d307d8c4bc09f3f88e032c;hb=aed8ec35ccb9cdeb7ea0cb6ff2946f9d83d582f6;hpb=8966833a87b9a002c9d72c56832e35b55628dc81 diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 25aa8af01..075733a68 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -132,9 +132,8 @@ sub insert { sub htpasswd_kludge { my $self = shift; - - #awful kludge to skip setting htpasswd for fs_* users - return '' if $self->username =~ /^fs_/; + + return '' if $self->is_system_user; unshift @_, '-c' unless -e $htpasswd_file; if ( @@ -270,7 +269,9 @@ Returns a name string for this user: "Last, First". sub name { my $self = shift; - $self->get('last'). ', '. $self->first; + return $self->username + if $self->get('last') eq 'Lastname' && $self->first eq 'Firstname'; + return $self->get('last'). ', '. $self->first; } =item user_cust_main @@ -413,10 +414,10 @@ sub agentnum { $sth->fetchrow_arrayref->[0]; } -=item agents +=item agents [ HASHREF | OPTION => VALUE ... ] Returns the list of agents this user can view (via group membership), as -FS::agent objects. +FS::agent objects. Accepts the same options as the agentnums_sql method. =cut @@ -425,7 +426,7 @@ sub agents { qsearch({ 'table' => 'agent', 'hashref' => { disabled=>'' }, - 'extra_sql' => ' AND '. $self->agentnums_sql, + 'extra_sql' => ' AND '. $self->agentnums_sql(@_), }); } @@ -510,6 +511,25 @@ sub default_customer_view { } +=item is_system_user + +Returns true if this user has the name of a known system account. These +users will not appear in the htpasswd file and can't have passwords set. + +=cut + +sub is_system_user { + my $self = shift; + return grep { $_ eq $self->username } ( qw( + fs_queue + fs_daily + fs_selfservice + fs_signup + fs_bootstrap + fs_selfserv +) ); +} + =back =head1 BUGS