\midcom_core_group

MidCOM group implementation supporting Midgard Groups.

Summary

Methods
Properties
Constants
__construct()
list_members()
list_memberships()
get_parent_group()
get_privileges()
get_storage()
$name
$id
$scope
No constants found
No protected methods found
$_storage
N/A
No private methods found
$_cached_parent_group
N/A

Properties

$name

$name : string

Name of the group

The variable is considered to be read-only.

Type

string

$id

$id : string

The identification string used to internally identify the group uniquely in the system. This is usually some kind of group:$guid string combination.

The variable is considered to be read-only.

Type

string

$scope

$scope : integer

The scope value, which must be set during the _load callback, indicates the "depth" of the group in the inheritance tree. This is used during privilege merging in the content privilege code, which needs a way to determine the proper ordering. Top level groups start with a scope of 1.

The variable is considered to be read-only.

Type

integer

$_storage

$_storage : \midgard_group

The storage object on which we are based. This is usually a midgard_group directly, as this class has to work outside of the ACLs. It must not be used from the outside.

Access to this member is restricted to the ACL user/group core. In case you need a real Storage object for this group, call get_storage() instead.

Type

\midgard_group

$_cached_parent_group

$_cached_parent_group : \midcom_core_group

Contains the parent of the current group, cached for repeated accesses.

Type

\midcom_core_group

Methods

__construct()

__construct(mixed  $id = null) 

The constructor retrieves the group identified by its name from the database and prepares the object for operation.

It will use the Query Builder to retrieve a group by its name and populate the $storage, $name and $id members accordingly.

Any error will trigger midcom_error.

Parameters

mixed $id

This is a valid identifier for the group to be loaded. Usually this is either a database ID or GUID for Midgard Groups or a valid complete MidCOM group identifier, which will work for all subclasses.

list_members()

list_members() : array<mixed,\midcom_core_user>

Retrieves a list of users for which are a member in this group.

Returns

array<mixed,\midcom_core_user> —

A list of user objects in which are members of the current group, indexed by their ID.

list_memberships()

list_memberships(\midcom_core_user  $user) : array<mixed,\midcom_core_group>

Return a list of all groups in which the MidCOM user passed is a member.

Parameters

\midcom_core_user $user

The user that should be looked up.

Returns

array<mixed,\midcom_core_group> —

Member groups, indexed by their ID.

get_parent_group()

get_parent_group() : \midcom_core_group

Returns the parent group.

Returns

\midcom_core_group

The parent group of the current group or null if there is none.

get_privileges()

get_privileges() : array<mixed,\midcom_core_privilege>

Return a list of privileges assigned directly to the group. The default implementation queries the GUID directly using the get_self_privileges method of the midcom_core_privilege class, which should work fine on all MgdSchema objects. If the storage object is null, an empty array is returned.

Returns

array<mixed,\midcom_core_privilege>

get_storage()

get_storage() : \midcom_db_group

Return a MidCOM DBA level storage object for the current group. Be aware, that depending on ACL information, the retrieval of the user may fail.

Also, as outlined in the member $_storage, not all groups may have a DBA object associated with them, therefore this call may return null.

The default implementation will return an instance of midcom_db_group based on the member $this->_storage->id if that object is defined, or null otherwise.

Returns

\midcom_db_group

A MidCOM DBA object that holds the information associated with this group, or null if there is no storage object.