1 package FS::access_group;
4 use base qw(FS::m2m_Common FS::m2name_Common FS::Record);
5 use FS::Record qw( qsearch qsearchs );
6 use FS::access_groupagent;
11 FS::access_group - Object methods for access_group records
17 $record = new FS::access_group \%hash;
18 $record = new FS::access_group { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::access_group object represents an access group. FS::access_group inherits from
31 FS::Record. The following fields are currently supported:
35 =item groupnum - primary key
37 =item groupname - Access group name
47 Creates a new access group. To add the access group to the database, see L<"insert">.
49 Note that this stores the hash reference, not a distinct copy of the hash it
50 points to. You can ask the object for a copy with the I<hash> method.
54 # the new method can be inherited from FS::Record, if a table method is defined
56 sub table { 'access_group'; }
60 Adds this record to the database. If there is an error, returns the error,
61 otherwise returns false.
65 # the insert method can be inherited from FS::Record
69 Delete this record from the database.
73 # the delete method can be inherited from FS::Record
75 =item replace OLD_RECORD
77 Replaces the OLD_RECORD with this one in the database. If there is an error,
78 returns the error, otherwise returns false.
82 # the replace method can be inherited from FS::Record
86 Checks all fields to make sure this is a valid access group. If there is
87 an error, returns the error, otherwise returns false. Called by the insert
92 # the check method should currently be supplied - FS::Record contains some
93 # data checking routines
99 $self->ut_numbern('groupnum')
100 || $self->ut_text('groupname')
102 return $error if $error;
107 =item access_groupagent
109 Returns all associated FS::access_groupagent records.
113 sub access_groupagent {
115 qsearch('access_groupagent', { 'groupnum' => $self->groupnum } );
120 Returns all associated FS::access_right records.
126 qsearch('access_right', { 'righttype' => 'FS::access_group',
127 'rightobjnum' => $self->groupnum
132 =item access_right RIGHTNAME
134 Returns the specified FS::access_right record. Can be used as a boolean, to
135 test if this group has the given RIGHTNAME.
140 my( $self, $name ) = @_;
141 qsearchs('access_right', { 'righttype' => 'FS::access_group',
142 'rightobjnum' => $self->groupnum,
143 'rightname' => $name,
154 L<FS::Record>, schema.html from the base documentation.