MidCOM group implementation supporting Midgard Groups.

package midcom

 Methods

__construct (mixed $id)

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

$id

mixedThis 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.

get_parent_group ()

Returns the parent group.

You must adhere the reference that is returned, otherwise the internal caching and runtime state strategy will fail.

Returns

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

get_privileges ()

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

arrayA list of midcom_core_privilege objects.

get_storage ()

This function will 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_core_dbaobjectAny MidCOM DBA level object that holds the information associated with this group, or null if there is no storage object.

list_members ()

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

Returns

ArrayA list of midcom_core_user objects in which are members of the current group, false on failure, indexed by their ID.

list_memberships (\midcom_core_user $user)

This method returns a list of all groups in which the MidCOM user passed is a member.
Static

Parameters

$user

\midcom_core_userThe user that should be looked-up.

Returns

ArrayAn array of member groups or false on failure, indexed by their ID.

list_subordinate_groups ()

Retrieves a list of groups owned by this group.

Returns

ArrayA list of midcom_core_group objects in which are owned by the current group, false on failure.

 Properties

 

string $id

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.

 

string $name

Name of the group

The variable is considered to be read-only.

 

integer $scope

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.

 

\midgard_group $_storage

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.

 

\midcom_core_group $_cached_parent_group

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