class_freeradiusAccount.inc 5.8 KB
Newer Older
1
2
<?php
/*
3
4
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2003-2009 GONICUS GmbH
5
  Copyright (C) 2012 WILLIAME Jeremy
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  Copyright (C) 2011-2016  FusionDirectory
 
  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.
 
  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.
 
  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.
*/
22
23
24
25
26


class freeradiusAccount extends simplePlugin {

  var $displayHeader = TRUE; // If we want the button Add/Delete
27
  var $objectclasses = array('radiusprofile');
28
29
30
31
32
33
34

  /*!
   * \brief Plugin information
   */
  static function plInfo ()
  {
    return array(
35
36
      'plShortName'   => _('Freeradius'),
      'plDescription' => _('This Plugin is for Radius accounting based in FreeRadius'),
37
38
      'plIcon'        => 'geticon.php?context=applications&icon=freeradius&size=48',
      'plSmallIcon'   => 'geticon.php?context=applications&icon=freeradius&size=16',
39
40
41
42
43
      'plSelfModify'  => TRUE,                  // Does this plugin have an owner that might be able to edit its entry
      'plPriority'    => 11,
      'plObjectType'  => array('user'),

      'plProvidedAcls' => parent::generatePlProvidedAcls(self::getAttributesInfo())
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    );
  }

  /*!
   *  \brief The main function : information about attributes
   */
  static function getAttributesInfo ()
  {
    return array(
    // Attributes are grouped by section
    'section1' => array(
        'name'  => _('Support 802.1x'),
        'attrs' => array(
          new StringAttribute(
58
59
            _('Tunnel medium type'), _('Name of the tunnel medium type'),
            'radiusTunnelMediumType', TRUE,
60
            'IEEE-802'
61
62
          ),
            new StringAttribute(
63
64
65
            _('Tunnel type'), _('Name of the tunnel type'),
            'radiusTunnelType', TRUE,
            'VLAN'
66
67
          ),
          new StringAttribute(
68
69
            _('VLAN id'), _('VLAN identifier'),
            'radiusTunnelPrivateGroupId', FALSE,
70
71
            ''
          ),
72
          new DateAttribute(
73
74
75
              _('Expiration date'), _('Date of the expiration account'),
              'radiusExpiration', FALSE,
              'd M Y', ''
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
          ),
        )
      ),
      'section2' => array(
        'name'  => _('Groups'),
        'attrs' => array(
          new SetAttribute(               // This attribute is multi-valuated
              new SelectAttribute (
              _('Groups'),                // Label of the attribute
              _('FreeRadius Group'),      // Description
              'radiusGroupName',          // LDAP name
              FALSE,                      // Mandatory
              array("")                   // [SelectAttribute] Choices
            )
          ),
        ),
      ),
      'section3' => array(
94
        'name'  => _('User preferences'),
95
96
          'attrs' => array(
            new StringAttribute(
97
98
              _('Protocol'), _('Protocol'),
              'radiusFramedProtocol', FALSE,
99
100
101
              'PPP'
            ),
            new StringAttribute(
102
103
              _('IP Address'), _('IP Address'),
              'radiusFramedIPAddress', FALSE,
104
105
106
              '255.255.255.254'
            ),
            new StringAttribute(
107
108
              _('IP Netmask'), _('IP Netmask'),
              'radiusFramedIPNetmask', FALSE,
109
110
111
              ''
            ),
            new IntAttribute(
112
113
              _('Framed-MTU'), _('Framed-MTU'),
              'radiusFramedMTU', FALSE,
114
115
116
117
118
              0,                                // [FloatAttribute] Minimum value
              FALSE,                            // [FloatAttribute] No maximum value
              1500                              // [FloatAttribute] Default value
            ),
            new StringAttribute(
119
120
              _('Compression'), _('Compression'),
              'radiusFramedCompression', FALSE,
121
122
123
              'Van-Jacobsen-TCP-IP'
            ),
             new StringAttribute(
124
125
              _('Service type'), _('Service type'),
              'radiusServiceType', FALSE,
126
127
128
              'Framed-User'
            ),
            new IntAttribute(
129
130
              _('Session Timeout'), _('Session Timeout'),
              'radiusSessionTimeout', FALSE,                    // Mandatory
131
132
133
134
135
              FALSE,                    // no minimum value
              FALSE,                    // no maximum value
              ""                        // no default value
            ),
            new IntAttribute(
136
137
              _('Idle Timeout'), _('Idle Timeout'),
              'radiusIdleTimeout', FALSE,
138
139
140
141
142
              "",
              FALSE,
              10
            ),
            new IntAttribute(
143
144
              _('Port limit'), _('Port limit'),
              'radiusPortLimit', FALSE,
145
146
147
148
149
150
151
152
              0,
              FALSE,
              2
            )
          )
        )
    );
  }
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

  /*!
   * \brief Constructor of the freeradiusAccount
   *        It will build the select groups choices
   */
  function __construct(&$config, $dn = NULL, $object = NULL)
  {
    parent::__construct($config, $dn, $object);
    $ldap = $this->config->get_ldap_link();
    $ldap->cd($this->config->current['BASE']);
    $ldap->search('(objectClass=radiusprofile)', array('cn'));
    $groups = array();
    while ($attrs = $ldap->fetch()) {
      $groups[] = $attrs['cn'][0];
    }
    $this->attributesAccess['radiusGroupName']->attribute->setChoices($groups);
  }
170
171
172
}

?>