Tilmeld Server API  1.0.0
Nymph user and group management with access controls.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
Tilmeld\Entities\Group Class Reference

A group entity. More...

Inheritance diagram for Tilmeld\Entities\Group:
Tilmeld\Entities\AbleObject

Public Member Functions

 __construct ($id=0)
 Load a group. More...
 
 getAvatar ()
 
 putData ($data, $sdata=[])
 
 updateDataProtection ($user=null)
 Update the data protection arrays for a user. More...
 
 isDescendant ($group=null)
 Check whether the group is a descendant of a group. More...
 
 getChildren ()
 Gets an array of the group's child groups. More...
 
 getDescendants ($andSelf=false)
 Gets an array of the group's descendant groups. More...
 
 getLevel ()
 Get the number of parents the group has. More...
 
 getUsers ( $descendants=false, $limit=null, $offset=null)
 Gets an array of users in the group. More...
 
 checkGroupname ()
 Check that a groupname is valid. More...
 
 checkEmail ()
 Check that an email is unique. More...
 
 save ()
 
 saveSkipAC ()
 
 tilmeldSaveSkipAC ()
 
 delete ()
 
- Public Member Functions inherited from Tilmeld\Entities\AbleObject
 grant ($ability)
 Grant an ability. More...
 
 revoke ($ability)
 Revoke an ability. More...
 

Static Public Member Functions

static getPrimaryGroups ($search=null)
 Get all the groups that can be assigned as primary groups. More...
 
static getSecondaryGroups ($search=null)
 Get all the groups that can be assigned as secondary groups. More...
 

Public Attributes

const ETYPE = 'tilmeld_group'
 
const DEFAULT_PRIVATE_DATA
 
const DEFAULT_WHITELIST_DATA = []
 
 $clientEnabledMethods
 

Static Public Attributes

static $clientEnabledStaticMethods
 
static $searchRestrictedData = Group::DEFAULT_PRIVATE_DATA
 

Protected Attributes

 $tags = []
 
 $privateData = Group::DEFAULT_PRIVATE_DATA
 
 $whitelistData = Group::DEFAULT_WHITELIST_DATA
 
 $whitelistTags = []
 

Detailed Description

A group entity.

Note: When delete() is called all descendants of this group will also be deleted.

Properties:

Author
Hunter Perrin hperr.nosp@m.in@g.nosp@m.mail..nosp@m.com
See also
http://tilmeld.org/

Definition at line 49 of file Group.php.

Constructor & Destructor Documentation

◆ __construct()

Tilmeld\Entities\Group::__construct (   $id = 0)

Load a group.

Parameters
int$idThe ID of the group to load, 0 for a new group.

Definition at line 97 of file Group.php.

Member Function Documentation

◆ checkEmail()

Tilmeld\Entities\Group::checkEmail ( )

Check that an email is unique.

Returns
array An associative array with a boolean 'result' entry and a 'message' entry.

Definition at line 463 of file Group.php.

◆ checkGroupname()

Tilmeld\Entities\Group::checkGroupname ( )

Check that a groupname is valid.

Returns
array An associative array with a boolean 'result' entry and a 'message' entry.

Definition at line 393 of file Group.php.

◆ getChildren()

Tilmeld\Entities\Group::getChildren ( )

Gets an array of the group's child groups.

Returns
array An array of groups.

Definition at line 287 of file Group.php.

◆ getDescendants()

Tilmeld\Entities\Group::getDescendants (   $andSelf = false)

Gets an array of the group's descendant groups.

Parameters
bool$andSelfInclude this group in the returned array.
Returns
array An array of groups.

Definition at line 304 of file Group.php.

◆ getLevel()

Tilmeld\Entities\Group::getLevel ( )

Get the number of parents the group has.

If the group is a top level group, this will return 0. If it is a child of a top level group, this will return 1. If it is a grandchild of a top level group, this will return 2, and so on.

Returns
int The level of the group.

Definition at line 337 of file Group.php.

◆ getPrimaryGroups()

static Tilmeld\Entities\Group::getPrimaryGroups (   $search = null)
static

Get all the groups that can be assigned as primary groups.

Parameters
string | null$searchA search query. If null, all will be returned. Uses ilike on name and groupname.
Returns
array An array of the assignable primary groups.

Definition at line 137 of file Group.php.

◆ getSecondaryGroups()

static Tilmeld\Entities\Group::getSecondaryGroups (   $search = null)
static

Get all the groups that can be assigned as secondary groups.

Parameters
string | null$searchA search query. If null, all will be returned. Uses ilike on name and groupname.
Returns
array An array of the assignable secondary groups.

Definition at line 150 of file Group.php.

◆ getUsers()

Tilmeld\Entities\Group::getUsers (   $descendants = false,
  $limit = null,
  $offset = null 
)

Gets an array of users in the group.

Parameters
bool$descendantsInclude users in all descendant groups too.
int | null$limitThe limit for the query.
int | null$offsetThe offset for the query.
Returns
array An array of users.

Definition at line 355 of file Group.php.

◆ isDescendant()

Tilmeld\Entities\Group::isDescendant (   $group = null)

Check whether the group is a descendant of a group.

Parameters
mixed$groupThe group, or the group's GUID.
Returns
bool True or false.

Definition at line 262 of file Group.php.

◆ updateDataProtection()

Tilmeld\Entities\Group::updateDataProtection (   $user = null)

Update the data protection arrays for a user.

Parameters
\Tilmeld\Entities\User | null$userUser to update protection for. If null, will use the currently logged in user.

Definition at line 233 of file Group.php.

Member Data Documentation

◆ $clientEnabledMethods

Tilmeld\Entities\Group::$clientEnabledMethods
Initial value:
= [
'checkGroupname',
'checkEmail',
'getAvatar',
'getChildren',
'getDescendants',
'getLevel',
'isDescendant',
]

Definition at line 66 of file Group.php.

◆ $clientEnabledStaticMethods

Tilmeld\Entities\Group::$clientEnabledStaticMethods
static
Initial value:
= [
'getPrimaryGroups',
'getSecondaryGroups',
]

Definition at line 75 of file Group.php.

◆ DEFAULT_PRIVATE_DATA

const Tilmeld\Entities\Group::DEFAULT_PRIVATE_DATA
Initial value:
= [
'email',
'phone',
'addressType',
'addressStreet',
'addressStreet2',
'addressCity',
'addressState',
'addressZip',
'addressInternational',
'abilities',
'user',
]

Definition at line 51 of file Group.php.


The documentation for this class was generated from the following file: