1 package FS::access_group;
2 use base qw( FS::m2m_Common FS::m2name_Common FS::Record );
5 use FS::Record qw( qsearch qsearchs );
10 FS::access_group - Object methods for access_group records
16 $record = new FS::access_group \%hash;
17 $record = new FS::access_group { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::access_group object represents an access group. FS::access_group inherits from
30 FS::Record. The following fields are currently supported:
34 =item groupnum - primary key
36 =item groupname - Access group name
46 Creates a new access group. To add the access group to the database, see L<"insert">.
48 Note that this stores the hash reference, not a distinct copy of the hash it
49 points to. You can ask the object for a copy with the I<hash> method.
53 # the new method can be inherited from FS::Record, if a table method is defined
55 sub table { 'access_group'; }
59 Adds this record to the database. If there is an error, returns the error,
60 otherwise returns false.
64 # the insert method can be inherited from FS::Record
68 Delete this record from the database.
72 # the delete method can be inherited from FS::Record
74 =item replace OLD_RECORD
76 Replaces the OLD_RECORD with this one in the database. If there is an error,
77 returns the error, otherwise returns false.
81 # the replace method can be inherited from FS::Record
85 Checks all fields to make sure this is a valid access group. If there is
86 an error, returns the error, otherwise returns false. Called by the insert
91 # the check method should currently be supplied - FS::Record contains some
92 # data checking routines
98 $self->ut_numbern('groupnum')
99 || $self->ut_text('groupname')
101 return $error if $error;
106 =item access_groupagent
108 Returns all associated FS::access_groupagent records.
112 Returns all associated FS::access_right records.
118 qsearch('access_right', { 'righttype' => 'FS::access_group',
119 'rightobjnum' => $self->groupnum
124 =item access_right RIGHTNAME
126 Returns the specified FS::access_right record. Can be used as a boolean, to
127 test if this group has the given RIGHTNAME.
132 my( $self, $name ) = @_;
133 qsearchs('access_right', { 'righttype' => 'FS::access_group',
134 'rightobjnum' => $self->groupnum,
135 'rightname' => $name,
146 L<FS::Record>, schema.html from the base documentation.