class_freeradiusAccount.inc 6.05 KB
Newer Older
1
2
<?php
/*
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2003-2009 GONICUS GmbH
  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.
*/
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

/*!
 * \file class_freeradiusAccount.inc
 * Source code for class freeradiusAccount
 */

/*!
 * \brief   FreeRadius plugin
 * \author  WILLIAME Jeremy <williamejeremy@hotmail.com>, Alejandro Escanero Blanco <aescanero@gmail.com>
 * \version 0.01
 * \date    25.06.2012
 * \see simplePlugin
 */

class freeradiusAccount extends simplePlugin {

  var $displayHeader = TRUE; // If we want the button Add/Delete
38
  var $objectclasses = array('radiusprofile');
39
40
41
42
43
44
45

  /*!
   * \brief Plugin information
   */
  static function plInfo ()
  {
    return array(
46
47
      'plShortName'   => _('Freeradius'),
      'plDescription' => _('This Plugin is for Radius accounting based in FreeRadius'),
48
49
      'plIcon'        => 'geticon.php?context=applications&icon=freeradius&size=48',
      'plSmallIcon'   => 'geticon.php?context=applications&icon=freeradius&size=16',
50
51
52
53
54
      '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())
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    );
  }

  /*!
   *  \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(
69
70
            _('Tunnel medium type'), _('Name of the tunnel medium type'),
            'radiusTunnelMediumType', TRUE,
71
            'IEEE-802'
72
73
          ),
            new StringAttribute(
74
75
76
            _('Tunnel type'), _('Name of the tunnel type'),
            'radiusTunnelType', TRUE,
            'VLAN'
77
78
          ),
          new StringAttribute(
79
80
            _('VLAN id'), _('VLAN identifier'),
            'radiusTunnelPrivateGroupId', FALSE,
81
82
            ''
          ),
83
          new DateAttribute(
84
85
86
              _('Expiration date'), _('Date of the expiration account'),
              'radiusExpiration', FALSE,
              'd M Y', ''
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
          ),
        )
      ),
      '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(
105
        'name'  => _('User preferences'),
106
107
          'attrs' => array(
            new StringAttribute(
108
109
              _('Protocol'), _('Protocol'),
              'radiusFramedProtocol', FALSE,
110
111
112
              'PPP'
            ),
            new StringAttribute(
113
114
              _('IP Address'), _('IP Address'),
              'radiusFramedIPAddress', FALSE,
115
116
117
              '255.255.255.254'
            ),
            new StringAttribute(
118
119
              _('IP Netmask'), _('IP Netmask'),
              'radiusFramedIPNetmask', FALSE,
120
121
122
              ''
            ),
            new IntAttribute(
123
124
              _('Framed-MTU'), _('Framed-MTU'),
              'radiusFramedMTU', FALSE,
125
126
127
128
129
              0,                                // [FloatAttribute] Minimum value
              FALSE,                            // [FloatAttribute] No maximum value
              1500                              // [FloatAttribute] Default value
            ),
            new StringAttribute(
130
131
              _('Compression'), _('Compression'),
              'radiusFramedCompression', FALSE,
132
133
134
              'Van-Jacobsen-TCP-IP'
            ),
             new StringAttribute(
135
136
              _('Service type'), _('Service type'),
              'radiusServiceType', FALSE,
137
138
139
              'Framed-User'
            ),
            new IntAttribute(
140
141
              _('Session Timeout'), _('Session Timeout'),
              'radiusSessionTimeout', FALSE,                    // Mandatory
142
143
144
145
146
              FALSE,                    // no minimum value
              FALSE,                    // no maximum value
              ""                        // no default value
            ),
            new IntAttribute(
147
148
              _('Idle Timeout'), _('Idle Timeout'),
              'radiusIdleTimeout', FALSE,
149
150
151
152
153
              "",
              FALSE,
              10
            ),
            new IntAttribute(
154
155
              _('Port limit'), _('Port limit'),
              'radiusPortLimit', FALSE,
156
157
158
159
160
161
162
163
              0,
              FALSE,
              2
            )
          )
        )
    );
  }
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

  /*!
   * \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);
  }
181
182
183
}

?>