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

5
  Copyright (C) 2014-2015 Dhatim
6
  Copyright (C) 2014-2019 FusionDirectory
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

  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 ppolicyConfig extends simplePlugin
{
25
  static function plInfo (): array
26
  {
27
    return [
28
29
      'plShortName'     => _('Ppolicy plugin configuration'),
      'plDescription'   => _('FusionDirectory ppolicy plugin configuration'),
30
31
32
      'plObjectClass'   => ['fdPpolicyPluginConf'],
      'plCategory'      => ['configuration'],
      'plObjectType'    => ['smallConfig'],
33

34
      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
35
    ];
36
37
  }

38
  static function getAttributesInfo (): array
39
  {
40
41
    return [
      'main' => [
42
        'name'  => _('Ppolicy'),
43
        'attrs' => [
44
          new StringAttribute(
45
46
47
48
            _('Ppolicy RDN'), _('Branch in which ppolicies will be stored'),
            'fdPpolicyRDN', TRUE,
            'ou=ppolicies'
          ),
49
          new StringAttribute(
50
51
            _('Default ppolicy dn'), _('What you put as default ppolicy in the overlay config'),
            'fdPpolicyDefaultDn', FALSE
52
          ),
53
          new HiddenAttribute('fdPpolicyDefaultCn'),
54
55
56
        ]
      ],
    ];
57
  }
58
59
60
61
62
63
64
65
66
67
68
69
70
71

  function __construct (string $dn = NULL, $object = NULL, $parent = NULL, bool $mainTab = FALSE)
  {
    global $config;

    parent::__construct($dn, $object, $parent, $mainTab);

    if (!empty($this->fdPpolicyDefaultCn)) {
      if (empty($this->fdPpolicyDefaultDn)) {
        $this->fdPpolicyDefaultDn = 'cn='.$this->fdPpolicyDefaultCn.','.get_ou('ppolicyRDN').$config->current['BASE'];
      }
      $this->fdPpolicyDefaultCn = '';
    }
  }
72
}