+=item access_groupagent
+
+Returns all associated FS::access_groupagent records.
+
+=item access_rights
+
+Returns all associated FS::access_right records.
+
+=cut
+
+sub access_rights {
+ my $self = shift;
+ qsearch('access_right', { 'righttype' => 'FS::access_group',
+ 'rightobjnum' => $self->groupnum
+ }
+ );
+}
+
+=item access_right RIGHTNAME
+
+Returns the specified FS::access_right record. Can be used as a boolean, to
+test if this group has the given RIGHTNAME.
+
+=cut
+
+sub access_right {
+ my( $self, $name ) = @_;
+ qsearchs('access_right', { 'righttype' => 'FS::access_group',
+ 'rightobjnum' => $self->groupnum,
+ 'rightname' => $name,
+ }
+ );
+}
+
+=item grant_access_right RIGHTNAME
+
+Grant the specified specified FS::access_right record to this group.
+Return the FS::access_right record.
+
+=cut
+
+sub grant_access_right {
+ my ( $self, $rightname ) = @_;
+
+ croak "grant_access_right() requires \$rightname"
+ unless $rightname;
+
+ my $access_right = $self->access_right( $rightname );
+ return $access_right if $access_right;
+
+ $access_right = FS::access_right->new({
+ righttype => 'FS::access_group',
+ rightobjnum => $self->groupnum,
+ rightname => $rightname,
+ });
+ if ( my $error = $access_right->insert ) {
+ die "grant_access_right() error: $error";
+ }
+
+ $access_right;
+}
+
+=item revoke_access_right RIGHTNAME
+
+Revoke the specified FS::access_right record from this group.
+
+=cut
+
+sub revoke_access_right {
+ my ( $self, $rightname ) = @_;
+
+ croak "revoke_access_right() requires \$rightname"
+ unless $rightname;
+
+ my $access_right = $self->access_right( $rightname )
+ or return;
+
+ if ( my $error = $access_right->delete ) {
+ die "revoke_access_right() error: $error";
+ }
+}
+