GroupExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 9 1
1
<?php
2
3
namespace AdvancedLearning\Oauth2Server\Extensions;
4
5
use AdvancedLearning\Oauth2Server\Models\Scope;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\GridField\GridField;
8
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
9
use SilverStripe\ORM\DataExtension;
10
11
/**
12
 * Optionally adds scopes to groups, allows checking permissions for a Member based on scopes.
13
 *
14
 * @package AdvancedLearning\Oauth2Server\Extensions
15
 */
16
class GroupExtension extends DataExtension
17
{
18
    private static $many_many = [
19
        'Scopes' => Scope::class
20
    ];
21
22
    public function updateCMSFields(FieldList $fields)
23
    {
24
        $fields->addFieldToTab('Root.Oauth', GridField::create(
25
            'Scopes',
26
            'Scopes',
27
            $this->owner->Scopes(),
28
            GridFieldConfig_RelationEditor::create()
29
        ));
30
    }
31
}