% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::access_user - Object methods for access_user records
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;
An FS::access_user object represents an internal access user. FS::access_user inherits from FS::Record. The following fields are currently supported:
primary key
Empty or bcrypt
Last name
First name
Master customer for this employee (for commissions)
Default sales person for this employee (for reports)
Empty or 'Y'
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.
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
Delete this record from the database.
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
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.
Returns a name string for this user: "Last, First".
Returns the FS::cust_main object (see FS::cust_main), if any, for this user.
Returns the FS::sales object (see FS::sales), if any, for this user.
Returns links to the the groups this user is a part of, as FS::access_usergroup objects (see FS::access_usergroup).
Returns the number of agents this user can view (via group membership).
Returns a list of agentnums this user can view (via group membership).
Returns a hashref of agentnums this user can view.
Returns an sql fragement to select only agentnums this user can view.
Options are passed as a hashref or a list. Available options are:
The frament will also allow the selection of null agentnums.
The fragment will also allow the selection of null agentnums if the current user has the provided access right
Optional table name in which agentnum is being checked. Sometimes required to resolve 'column reference "agentnum" is ambiguous' errors.
All agents will be viewable if the current user has the provided access right. Defaults to 'View customers of all agents'.
Returns true if the user can view the specified agent.
Also accepts optional hashref cache, to avoid redundant database calls.
Returns the list of agents this user can view (via group membership), as FS::agent objects. Accepts the same options as the agentnums_sql method.
Returns an array of FS::access_user objects, one for each non-disabled access_user in the system that shares an agent (via group membership) with the invoking object. Regardless of options and agents, will always at least return the invoking user and any users who have viewall_right.
Accepts the following options:
Only return users who appear in the usernum field of this table
Include disabled users if true (defaults to false)
All users will be returned if the current user has the provided access right, regardless of agents (other filters still apply.) Defaults to 'View customers of all agents'
Accepts same options as "access_users". Returns a hashref of users, with keys of usernum and values of username.
Given a right name or a list reference of right names, returns true if this user has this right, or, for a list, one of the rights (currently via group membership, eventually also via user overrides).
Accepts payment $payby (BILL,CASH,MCRD,MCHK,CARD,CHEK) and returns a list of the refund rights associated with that $payby.
Returns empty list if $payby wasn't recognized.
Returns true if user has "access_right" for any "refund_rights" for the specified payby.
Returns the default customer view for this user, from the "default_customer_view" user preference, the "cust_main-default_view" config, or the hardcoded default, "basics" (formerly "jumbo" prior to 3.0).
Returns a hashref of this user's Excel spreadsheet download settings: 'extension' (xls or xlsx), 'class' (Spreadsheet::WriteExcel or Excel::Writer::XLSX), and 'mime_type'. If OVERRIDE is 'XLS' or 'XLSX', use that instead of the user's setting.
Returns true if this user has the name of a known system account. These users cannot log into the web interface and can't have passwords set.
Changes the user's password to NEW_PASSWORD. This does not check password policy rules (see is_password_allowed) and will return an error only if editing the user's record fails for some reason.
If NEW_PASSWORD is the same as the existing password, this does nothing.
Returns the user's page preference named NAME for the page at PATH. If the page is a view or edit page or otherwise shows a single record at a time, it should use TABLENUM to tell which record the preference is for.
Sets the user's page preference named NAME for the page at PATH. Use TABLENUM as for get_page_pref.
Fetch the prefvalue column from FS::access_user_pref for prefname NAME
Returns undef when no value has been saved, or when record has expired
Fetch the row object from FS::access_user_pref for prefname NAME
returns undef when no row has been created
Add or update user preference in FS::access_user_pref table
Passing an undefined VALUE will delete the user preference
Returns VALUE
Delete user preference from FS::access_user_pref table
FS::Record, schema.html from the base documentation.
Hey! The above document had some coding errors, which are explained below:
You forgot a '=back' before '=head1'