1 package FS::access_group;
5 use FS::Record qw( qsearch qsearchs );
7 use FS::access_groupagent;
10 @ISA = qw(FS::m2m_Common FS::m2name_Common FS::Record);
14 FS::access_group - Object methods for access_group records
20 $record = new FS::access_group \%hash;
21 $record = new FS::access_group { 'column' => 'value' };
23 $error = $record->insert;
25 $error = $new_record->replace($old_record);
27 $error = $record->delete;
29 $error = $record->check;
33 An FS::access_group object represents an access group. FS::access_group inherits from
34 FS::Record. The following fields are currently supported:
38 =item groupnum - primary key
40 =item groupname - Access group name
50 Creates a new access group. To add the access group to the database, see L<"insert">.
52 Note that this stores the hash reference, not a distinct copy of the hash it
53 points to. You can ask the object for a copy with the I<hash> method.
57 # the new method can be inherited from FS::Record, if a table method is defined
59 sub table { 'access_group'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
68 # the insert method can be inherited from FS::Record
72 Delete this record from the database.
76 # the delete method can be inherited from FS::Record
78 =item replace OLD_RECORD
80 Replaces the OLD_RECORD with this one in the database. If there is an error,
81 returns the error, otherwise returns false.
85 # the replace method can be inherited from FS::Record
89 Checks all fields to make sure this is a valid access group. If there is
90 an error, returns the error, otherwise returns false. Called by the insert
95 # the check method should currently be supplied - FS::Record contains some
96 # data checking routines
102 $self->ut_numbern('groupnum')
103 || $self->ut_text('groupname')
105 return $error if $error;
110 =item access_groupagent
112 Returns all associated FS::access_groupagent records.
116 sub access_groupagent {
118 qsearch('access_groupagent', { 'groupnum' => $self->groupnum } );
123 Returns all associated FS::access_right records.
129 qsearch('access_right', { 'righttype' => 'FS::access_group',
130 'rightobjnum' => $self->groupnum
135 =item access_right RIGHTNAME
137 Returns the specified FS::access_right record. Can be used as a boolean, to
138 test if this group has the given RIGHTNAME.
143 my( $self, $name ) = @_;
144 qsearchs('access_right', { 'righttype' => 'FS::access_group',
145 'rightobjnum' => $self->groupnum,
146 'rightname' => $name,
157 L<FS::Record>, schema.html from the base documentation.