2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Security\Tests\GroupTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\Forms\CheckboxSetField;
|
|
|
|
use SilverStripe\Forms\FieldList;
|
|
|
|
use SilverStripe\Forms\HiddenField;
|
|
|
|
use SilverStripe\ORM\DataObject;
|
|
|
|
use SilverStripe\Security\Group;
|
|
|
|
use SilverStripe\Security\Member;
|
|
|
|
|
|
|
|
class TestMember extends Member implements TestOnly
|
|
|
|
{
|
2016-12-16 05:34:21 +01:00
|
|
|
private static $table_name = 'GroupTest_Member';
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function getCMSFields()
|
|
|
|
{
|
|
|
|
$groups = DataObject::get(Group::class);
|
|
|
|
$groupsMap = ($groups) ? $groups->map() : false;
|
|
|
|
$fields = new FieldList(
|
|
|
|
new HiddenField('ID', 'ID'),
|
|
|
|
new CheckboxSetField(
|
|
|
|
'Groups',
|
|
|
|
'Groups',
|
|
|
|
$groupsMap
|
|
|
|
)
|
|
|
|
);
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
return $fields;
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|