Version: current

# Class Group

A security group.

  Object
  ViewableData implements IteratorAggregate
  DataObject implements DataObjectInterface, i18nEntityProvider
  Group

Package: sapphire\security
Located at sapphire/security/Group.php

## Methods summary

`public` | # `getAllChildren( )`
`public `FieldSet`` | # `getCMSFields( )` Caution: Only call on instances, not through a singleton. Caution: Only call on instances, not through a singleton. #### Returns ``FieldSet`` FieldSet #### Overrides `DataObject::getCMSFields`
`public array|string` | # `fieldLabels( boolean $includerelations = true )` #### Parameters $includerelations boolean $includerelations a boolean value to indicate if the labels returned include relation fields #### Returns `array|string` Array of all element labels if no argument given, otherwise the label of the field #### Overrides `DataObject::fieldLabels`
`public static` | # `addToGroupByName( `DataObject` $member, string $groupcode )` Add a member to a group. This will create the group if the given group code doesn't work. Add a member to a group. This will create the group if the given group code doesn't work. #### Parameters $member DataObject $member $groupcode string $groupcode
`public `ComponentSet`` | # `Members( mixed $limit = "", mixed $offset = "", mixed $filter = "", mixed $sort = "", mixed $join = "" )` Overloaded getter. Overloaded getter. #### Parameters $limit $limit string SQL $offset $offset int $filter $filter string SQL $sort $sort string SQL $join $join string SQL #### Returns ``ComponentSet`` ComponentSet #### TODO Where is this used, why is this overloaded?
`public` | # `map( mixed $filter = "", mixed $sort = "", mixed $blank = "" )`
`public array` | # `collateFamilyIDs( )` Return a set of this record's "family" of IDs - the IDs of this record and all its descendants. Return a set of this record's "family" of IDs - the IDs of this record and all its descendants. #### Returns `array` array
`public` | # `collateAncestorIDs( )` Returns an array of the IDs of this group and all its parents Returns an array of the IDs of this group and all its parents
`public` | # `cmsCleanup_parentChanged( )` This isn't a decendant of SiteTree, but needs this in case the group is "reorganised"; This isn't a decendant of SiteTree, but needs this in case the group is "reorganised";
`public` | # `stageChildren( )` Override this so groups are ordered in the CMS Override this so groups are ordered in the CMS
`public` | # `TreeTitle( )`
`public` | # `CMSTreeClasses( mixed $controller )`
`public` | # `setCode( mixed $val )` Overloaded to ensure the code is always descent. Overloaded to ensure the code is always descent.
`public` | # `onBeforeWrite( )` Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though! Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though! This called after $this->validate(), so you can be sure that your data is valid. #### Uses ``DataObjectDecorator::onBeforeWrite()`` #### Overrides `DataObject::onBeforeWrite`
`public` | # `onAfterDelete( )` #### Overrides `DataObject::onAfterDelete`
`public boolean` | # `canEdit( mixed $member = null )` Checks for permission-code CMS_ACCESS_SecurityAdmin. If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well. Checks for permission-code CMS_ACCESS_SecurityAdmin. If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well. #### Parameters $member $member Member #### Returns `boolean` boolean #### Overrides `DataObject::canEdit`
`public boolean` | # `canView( mixed $member = null )` Checks for permission-code CMS_ACCESS_SecurityAdmin. Checks for permission-code CMS_ACCESS_SecurityAdmin. #### Parameters $member $member Member #### Returns `boolean` boolean #### Overrides `DataObject::canView`
`public boolean` | # `canDelete( `Member` $member = null )` #### Parameters $member Member $member #### Returns `boolean` boolean #### Overrides `DataObject::canDelete`
`public` | # `AllChildrenIncludingDeleted( )` Returns all of the children for the CMS Tree. Filters to only those groups that the current user can edit Returns all of the children for the CMS Tree. Filters to only those groups that the current user can edit
`public` | # `allowedIPAddress( mixed $ip )` Returns true if the given IP address is granted access to this group. For unrestricted groups, this always returns true. Returns true if the given IP address is granted access to this group. For unrestricted groups, this always returns true.
`public` | # `requireDefaultRecords( )` Add default records to database. Add default records to database. This function is called whenever the database is built, after the database tables have all been created. #### Overrides `DataObject::requireDefaultRecords`

### Methods inherited from DataObject

`Aggregate()`, `RelationshipAggregate()`, `__construct()`, `baseTable()`, `belongs_to()`, `buildDataObjectSet()`, `buildSQL()`, `can()`, `canCreate()`, `castedUpdate()`, `composite_fields()`, `context_obj()`, `customDatabaseFields()`, `custom_database_fields()`, `data()`, `databaseFields()`, `databaseIndexes()`, `database_extensions()`, `database_fields()`, `db()`, `dbObject()`, `debug()`, `defaultSearchFilters()`, `defineMethods()`, `delete()`, `delete_by_id()`, `destroy()`, `disableCMSFieldsExtensions()`, `disable_subclass_access()`, `duplicate()`, `enableCMSFieldsExtensions()`, `enable_subclass_access()`, `exists()`, `extendedSQL()`, `fieldLabel()`, `flushCache()`, `flush_and_destroy_cache()`, `forceChange()`, `get()`, `getAllFields()`, `getCMSActions()`, `getChangedFields()`, `getClassAncestry()`, `getComponent()`, `getComponents()`, `getComponentsQuery()`, `getDefaultSearchContext()`, `getField()`, `getFrontEndFields()`, `getManyManyComponents()`, `getManyManyComponentsQuery()`, `getManyManyFilter()`, `getManyManyJoin()`, `getRemoteJoinField()`, `getReverseAssociation()`, `getTitle()`, `get_by_id()`, `get_one()`, `get_validation_enabled()`, `hasDatabaseField()`, `hasField()`, `hasOwnTableDatabaseField()`, `hasValue()`, `has_many()`, `has_one()`, `has_own_table()`, `i18n_plural_name()`, `i18n_singular_name()`, `inheritedDatabaseFields()`, `instance_get()`, `instance_get_one()`, `isChanged()`, `isEmpty()`, `isInDB()`, `is_composite_field()`, `many_many()`, `many_many_extraFields()`, `merge()`, `newClassInstance()`, `onAfterWrite()`, `onBeforeDelete()`, `plural_name()`, `populateDefaults()`, `provideI18nEntities()`, `relObject()`, `requireTable()`, `reset()`, `scaffoldFormFields()`, `scaffoldSearchFields()`, `searchableFields()`, `setCastedField()`, `setClassName()`, `setComponent()`, `setField()`, `set_context_obj()`, `set_validation_enabled()`, `singular_name()`, `summaryFields()`, `toMap()`, `update()`, `validate()`, `write()`, `writeComponents()`, `writeWithoutVersion()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `escapeTypeForField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public static array` | $db | # Database field definitions. This is a map from field names to field type. The field type should be a class that extends . Database field definitions. This is a map from field names to field type. The field type should be a class that extends .
`public static array` | $has_one | # One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a `DataObject::$belongs_to` relationship on the child class. One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a `DataObject::$belongs_to` relationship on the child class. Note that you cannot have a has_one and belongs_to relationship with the same name.
`public static array` | $has_many | # This defines a one-to-many relationship. It is a map of component name to the remote data class. This defines a one-to-many relationship. It is a map of component name to the remote data class. This relationship type does not actually create a data structure itself - you need to define a matching $has_one relationship on the child class. Also, if the $has_one relationship on the child class has multiple links to this class you can use the syntax "ClassName.HasOneRelationshipName" in the remote data class definition to show which foreign key to use.
`public static array` | $many_many | # many-many relationship definitions. This is a map from component name to data type. many-many relationship definitions. This is a map from component name to data type.
`public static array` | $extensions | # An array of extension names and parameters to be applied to this object upon construction. An array of extension names and parameters to be applied to this object upon construction. Example:
    public static $extensions = array (
      'Hierachy',
      "Version('Stage', 'Live')"
    );
Use `Object::add_extension()` to add extensions without access to the class code, e.g. to extend core classes. Extensions are instanciated together with the object and stored in `Object::$extension_instances`.

### Properties inherited from DataObject

`$allowed_actions`, `$ancestry`, `$api_access`, `$belongs_many_many`, `$belongs_to`, `$brokenOnDelete`, `$brokenOnWrite`, `$cache_get_one`, `$cache_has_own_table`, `$cache_has_own_table_field`, `$casting`, `$componentCache`, `$components`, `$create_table_options`, `$default_records`, `$default_sort`, `$defaults`, `$destroyed`, `$field_labels`, `$indexes`, `$many_many_extraFields`, `$original`, `$plural_name`, `$record`, `$searchable_fields`, `$singular_name`, `$summary_fields`

### Properties inherited from ViewableData

`$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -