class_freeradiusAccount.inc 5.15 KB
Newer Older
1
2
<?php
/*
3
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
4

5
  Copyright (C) 2003-2009 GONICUS GmbH
6
  Copyright (C) 2012 WILLIAME Jeremy
7
  Copyright (C) 2011-2020  FusionDirectory
8

9
10
11
12
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
13

14
15
16
17
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
18

19
20
21
22
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
23

24
25
class freeradiusAccount extends simplePlugin
{
26
  protected $displayHeader  = TRUE;
27

28
  static function plInfo (): array
29
  {
30
    return [
31
      'plShortName'   => _('Freeradius'),
32
      'plDescription' => _('FreeRadius information'),
33
      'plFilter'      => '(objectClass=radiusprofile)',
34
35
      'plIcon'        => 'geticon.php?context=applications&icon=freeradius&size=48',
      'plSmallIcon'   => 'geticon.php?context=applications&icon=freeradius&size=16',
Mortier Benoit's avatar
Mortier Benoit committed
36
      'plSelfModify'  => TRUE,
37
      'plPriority'    => 11,
38
      'plObjectClass' => ['radiusprofile'],
39
      'plObjectType'  => ['user','ipamVlan','ipamSubnet'],
40

41
      'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
42
    ];
43
44
  }

45
  static function getAttributesInfo (): array
46
  {
47
    return [
48
      'section1' => [
49
        'name'  => _('Support 802.1x'),
50
        'attrs' => [
51
          new StringAttribute(
52
53
            _('Tunnel medium type'), _('Name of the tunnel medium type'),
            'radiusTunnelMediumType', TRUE,
54
            'IEEE-802'
55
          ),
56
          new StringAttribute(
57
58
59
            _('Tunnel type'), _('Name of the tunnel type'),
            'radiusTunnelType', TRUE,
            'VLAN'
60
61
          ),
          new StringAttribute(
62
            _('VLAN id'), _('VLAN identifier'),
63
            'radiusTunnelPrivateGroupId', FALSE
64
          ),
65
          new DateAttribute(
66
67
68
            _('Expiration date'), _('Date of the expiration account'),
            'radiusExpiration', FALSE,
            'd M Y', ''
69
          ),
70
71
72
        ]
      ],
      'section2' => [
73
        'name'  => _('Groups'),
74
        'attrs' => [
Mortier Benoit's avatar
Mortier Benoit committed
75
          new SetAttribute(
76
            new ObjectSelectAttribute(
77
              _('Groups'), _('FreeRadius Groups'),
78
79
80
              'radiusGroupName', FALSE,
              ['group'], 'cn', 'cn',
              '(objectClass=radiusprofile)'
81
82
            )
          ),
83
84
85
        ],
      ],
      'section3' => [
86
        'name'  => _('User preferences'),
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
        'attrs' => [
          new StringAttribute(
            _('Protocol'), _('Protocol'),
            'radiusFramedProtocol', FALSE,
            'PPP'
          ),
          new StringAttribute(
            _('IP Address'), _('IP Address'),
            'radiusFramedIPAddress', FALSE,
            '255.255.255.254'
          ),
          new StringAttribute(
            _('IP Netmask'), _('IP Netmask'),
            'radiusFramedIPNetmask', FALSE
          ),
          new IntAttribute(
            _('Framed-MTU'), _('Framed-MTU'),
            'radiusFramedMTU', FALSE,
            0,
            FALSE,
            1500
          ),
          new StringAttribute(
            _('Compression'), _('Compression'),
            'radiusFramedCompression', FALSE,
            'Van-Jacobsen-TCP-IP'
          ),
          new StringAttribute(
            _('Service type'), _('Service type'),
            'radiusServiceType', FALSE,
            'Framed-User'
          ),
          new IntAttribute(
            _('Session Timeout'), _('Session Timeout'),
            'radiusSessionTimeout', FALSE,
            FALSE,
            FALSE
          ),
          new IntAttribute(
            _('Idle Timeout'), _('Idle Timeout'),
            'radiusIdleTimeout', FALSE,
            FALSE,
            FALSE,
            10
          ),
          new IntAttribute(
            _('Port limit'), _('Port limit'),
            'radiusPortLimit', FALSE,
            0,
            FALSE,
            2
          )
139
        ]
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
      ],
      'advanced' => [
        'name'  => _('Advanced'),
        'attrs' => [
          new SetAttribute(
            new StringAttribute(
              _('Control attributes'), _('Control attributes using format [qualifiers.]<attribute> <operator> <value>'),
              'radiusControlAttribute', FALSE
            )
          ),
          new SetAttribute(
            new StringAttribute(
              _('Reply attributes'), _('Reply attributes using format [qualifiers.]<attribute> <operator> <value>'),
              'radiusReplyAttribute', FALSE
            )
          ),
          new SetAttribute(
            new StringAttribute(
              _('Request attributes'), _('Request attributes using format [qualifiers.]<attribute> <operator> <value>'),
              'radiusRequestAttribute', FALSE
            )
          ),
        ],
      ],
164
    ];
165
166
  }
}