Freeside:1.9:Documentation:Developer/FS/access user

From Freeside
Jump to: navigation, search

NAME

FS::access_user - Object methods for access_user records

SYNOPSIS

 use FS::access_user;

 $record = new FS::access_user \%hash;
 $record = new FS::access_user { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::access_user object represents an internal access user. FS::access_user inherits from FS::Record. The following fields are currently supported:

usernum - primary key; username -; _password -; last -; first -; disabled - empty or 'Y'

METHODS

new HASHREF
Creates a new internal access user. To add the user to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid internal access user. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
name
Returns a name string for this user: "Last, First".
access_usergroup; agentnums
Returns a list of agentnums this user can view (via group membership).
agentnums_href
Returns a hashref of agentnums this user can view.
agentnums_sql [ HASHREF | OPTION => VALUE ... ]
Returns an sql fragement to select only agentnums this user can view.
Options are passed as a hashref or a list. Available options are:
null
The frament will also allow the selection of null agentnums.
null_right
The fragment will also allow the selection of null agentnums if the current user has the provided access right
table
Optional table name in which agentnum is being checked. Sometimes required to resolve 'column reference "agentnum" is ambiguous' errors.
agentnum
Returns true if the user can view the specified agent.
agents
Returns the list of agents this user can view (via group membership), as FS::agent objects.
access_right
Given a right name, returns true if this user has this right (currently via group membership, eventually also via user overrides).

BUGS

SEE ALSO

FS::Record, schema.html from the base documentation.