| Elive documentation | view source | Contained in the Elive distribution. |
Elive::Entity::Group - Elluminate Group entity instance class
These are used to maintain user groups for general use. In particular, for group selection of meeting participants.
The members property contains the group members as an array of user IDs
or sub-group objects.
If the a site is configured for LDAP, groups are mapped to LDAP groups.
Group access becomes read-only. The affected methods are: insert, update,
and delete.
=cut
sub _freeze { my $class = shift; my $app_data = shift;
$app_data = $class->SUPER::_freeze($app_data, @_);
$app_data->{groupId} =~ s{^\*}{} if $app_data->{groupId};
return $app_data;
}
sub _thaw { my $class = shift; my $db_data = shift; my $path = shift || '';
return $db_data unless ref $db_data;
return $class->SUPER::_thaw($db_data, $path, @_);
}
#
# insert from an array of User Ids. Elements may be integers, strings
# and/or user objects.
#
my $alice = Elive::Entity::User->get_by_loginName('alice');
my $bob = Elive::Entity::User->get_by_loginName('bob');
my $group = Elive::Entity::Group->insert({
name => 'Elluminati',
# following are all ok
members => [111111, '222222', $alice->userId, $bob ],
},
);
#
# insert from a comma separated string of user IDs
#
my $group = Elive::Entity::Group->insert({
name => 'Elluminati',
members => '111111,222222,333333',
},
);
Inserts a new group from data.
$group->update({members => [111111,'222222', $alice->userId, $bob]});
$group->update({members => '111111,222222,333333'});
This is a utility method that includes the sum total of all members in the group, including those in recursively nested sub-groups. The list is further reduced to only include unique members.
my @all_members = $group_obj->expand_members();
| Elive documentation | view source | Contained in the Elive distribution. |