class_configInLdap.inc 21.41 KiB
<?php
/*
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2012-2019 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.
class configInLdap extends simplePlugin
  static function plInfo (): array
    return [
      'plShortName'     => _('Configuration'),
      'plTitle'         => _('FusionDirectory configuration'),
      'plDescription'   => _('Configuration screen of FusionDirectory'),
      'plIcon'          => 'geticon.php?context=categories&icon=settings&size=48',
      'plObjectClass'   => ['fusionDirectoryConf'],
      'plObjectType'    => [
        'configuration' => [
          'name'      => _('FusionDirectory configuration'),
          'filter'    => 'objectClass=fusionDirectoryConf',
          'tabClass'  => 'configInLdapTabs',
          'icon'      => 'geticon.php?context=categories&icon=settings&size=16',
          'mainAttr'  => FALSE,
          'ou'        => preg_replace('/^[^,]+,/', '', CONFIGRDN)
      'plSection'       => ['conf' => ['name' => _('Configuration'), 'priority' => 20]],
      'plManages'       => ['configuration'],
      'plPriority'      => 0,
      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
  static function getAttributesInfo (): array
    global $config;
    return [
      'look_n_feel' => [
        'name'  => _('Look and feel'),
        'attrs' => [
          new SelectAttribute(
            _('Language'), _('Language of the application. If \'automatic\' or not available, the one asked by the browser will be used. This setting can be overriden per user.'),
            'fdLanguage', FALSE,
            ['']
          new SelectAttribute(
            _('Theme'), _('Theme to be used'),
            'fdTheme', TRUE,
            static::get_themes(),
            'breezy'
          new SelectAttribute(
            _('Timezone'), _('Timezone to be used'),
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
'fdTimezone', TRUE, ['America/New_York'] ), new HiddenAttribute('fusionConfigMd5'), new HiddenAttribute('fdIncrementalModifierStates'), ] ], 'core_settings' => [ 'name' => _('Core settings'), 'attrs' => [ new IntAttribute( _('LDAP size limit'), _('Defines the number of entries to get from LDAP by default.'), 'fdLdapSizeLimit', FALSE, 0 /*min*/, FALSE /*no max*/, 200 ), new SelectAttribute( _('Edit locking'), _('Check if a entry currently being edited has been modified outside of FusionDirectory in the meantime.'), 'fdModificationDetectionAttribute', FALSE, ['', 'entryCSN', 'contextCSN'], 'entryCSN' ), new BooleanAttribute( _('Enable logging'), _('Event logging on FusionDirectory side.'), 'fdLogging', FALSE, TRUE ), new BooleanAttribute( _('Schema validation'), _('Enables schema checking during login.'), 'fdSchemaCheck', FALSE, TRUE ), new BooleanAttribute( _('Enable snapshots'), _('This enables you to save certain states of entries and restore them later on.'), 'fdEnableSnapshots', FALSE, TRUE ), new StringAttribute( _('Snapshot base'), _('The base where snapshots should be stored inside of the LDAP.'), 'fdSnapshotBase', FALSE, 'ou=snapshots,'.$config->current['BASE'] ), new BooleanAttribute( _('Wildcard foreign keys'), _('Enables wildcard searches like member=* when moving a whole department. This will open all existing groups and roles to make sure foreign keys are respected. Slow on big trees.'), 'fdWildcardForeignKeys', FALSE, TRUE ), ] ], 'password' => [ 'name' => _('Password settings'), 'attrs' => [ new SetAttribute( new SelectAttribute( _('Allowed password hashes'), _('Password hashes which may be used for user passwords'), 'fdPasswordAllowedHashes', TRUE, ['ssha'] ) ), new SelectAttribute( _('Password default hash'), _('Default hash to be used'), 'fdPasswordDefaultHash', TRUE, ['ssha'] ), new BooleanAttribute( _('Force default hash'), _('Force the use of the default password hash'), 'fdForcePasswordDefaultHash' ), new IntAttribute(
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
_('Password minimum length'), _('Minimum length of user passwords'), 'fdPasswordMinLength', FALSE, 0 /*min*/, FALSE /*no max*/ ), new IntAttribute( _('Password minimum differs'), _('Minimum number of different characters from last password'), 'fdPasswordMinDiffer', FALSE, 0 /*min*/, FALSE /*no max*/ ), new BooleanAttribute( _('Use account expiration'), _('Enables shadow attribute tests during the login to FusionDirectory and forces password renewal or account locking'), 'fdHandleExpiredAccounts' ), new StringAttribute( _('SASL Realm'), _('SASL Realm'), 'fdSaslRealm' ), new StringAttribute( _('SASL Exop'), _('Attribute to be stored in the userPassword attribute'), 'fdSaslExop' ), ] ], 'login' => [ 'name' => _('Login and session'), 'attrs' => [ new SelectAttribute( _('Login attribute'), _('Which LDAP attribute should be used as the login name during login.'), 'fdLoginAttribute', TRUE, ['uid', 'mail', 'uid,mail'], 'uid', ['uid', 'mail', 'both'] ), new BooleanAttribute( _('Enforce encrypted connections'), _('Enables PHP security checks to force encrypted access (https) to the web interface.'), 'fdForceSSL' ), new BooleanAttribute( _('Warn if session is not encrypted'), _('will display a warning to the user when http is used instead of https.'), 'fdWarnSSL', FALSE, TRUE ), new IntAttribute( _('Session lifetime'), _('Defines when a session will expire in seconds (0 to disable).'), 'fdSessionLifeTime', TRUE, 0 /*min*/, FALSE /*no max*/, 1800 ), new SelectAttribute( _('Login method'), _('Which login method should be used for connecting to FusionDirectory'), 'fdLoginMethod', TRUE ), new StringAttribute( _('Header name'), _('Name of the header containing user identifier.'), 'fdHttpHeaderAuthHeaderName', FALSE, 'AUTH_USER' ), ] ], 'ssl' => [ 'name' => _('SSL'), 'attrs' => [ new TrimmedStringAttribute( _('Key path'), _('Path to FusionDirectory private key. Unused for now.'), 'fdSslKeyPath', FALSE, '/etc/ssl/private/fd.key' ),