new type API

This commit is contained in:
Roland Gruber 2016-12-26 18:41:22 +01:00
parent fad7a009f0
commit 0bf8702763
4 changed files with 94 additions and 81 deletions

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\OU_EDIT;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 Roland Gruber
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -30,56 +31,56 @@ $Id$
/**
* OU editor
*
*
* @package tools
*/
class toolOUEditor implements LAMTool {
*/
class toolOUEditor implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("OU editor");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Manages OU objects in your LDAP tree.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "ou_edit.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return true;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolOUEditor implements LAMTool {
function getImageLink() {
return 'ou.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolOUEditor implements LAMTool {
function getPosition() {
return 500;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolOUEditor implements LAMTool {
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\PDF_EDITOR;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 Roland Gruber
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -30,56 +31,56 @@ $Id$
/**
* PDF editor
*
*
* @package tools
*/
class toolPDFEditor implements LAMTool {
*/
class toolPDFEditor implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("PDF editor");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("This tool allows you to customize the PDF pages.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "pdfedit/pdfmain.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return true;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolPDFEditor implements LAMTool {
function getImageLink() {
return 'pdf.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolPDFEditor implements LAMTool {
function getPosition() {
return 200;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolPDFEditor implements LAMTool {
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\PROFILE_EDITOR;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 Roland Gruber
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -30,56 +31,56 @@ $Id$
/**
* Profile editor
*
*
* @package tools
*/
class toolProfileEditor implements LAMTool {
*/
class toolProfileEditor implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("Profile editor");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Here you can manage your account profiles.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "profedit/profilemain.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return true;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolProfileEditor implements LAMTool {
function getImageLink() {
return 'edit.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolProfileEditor implements LAMTool {
function getPosition() {
return 100;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolProfileEditor implements LAMTool {
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,4 +1,15 @@
<?php
namespace LAM\TOOLS\OU_EDIT;
use \htmlTable;
use \htmlSpacer;
use \htmlOutputText;
use \htmlButton;
use \htmlHiddenInput;
use \htmlSubTitle;
use \htmlStatusMessage;
use \htmlSelect;
use \htmlHelpLink;
use \htmlInputField;
/*
$Id$
@ -51,8 +62,6 @@ if (!empty($_POST)) {
validateSecurityToken();
}
$types = $_SESSION['config']->get_ActiveTypes();
// check if deletion was canceled
if (isset($_POST['abort'])) {
display_main(null, null);
@ -166,13 +175,14 @@ function display_main($message, $error) {
$container->addElement($msg, true);
}
$typeManager = new \LAM\TYPES\TypeManager();
$typeList = $typeManager->getConfiguredTypes();
$types = array();
$typeList = $_SESSION['config']->get_ActiveTypes();
for ($i = 0; $i < sizeof($typeList); $i++) {
if (isAccountTypeHidden($typeList[$i]) || !checkIfWriteAccessIsAllowed($typeList[$i])) {
foreach ($typeList as $type) {
if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) {
continue;
}
$types[$typeList[$i]] = LAM\TYPES\getTypeAlias($typeList[$i]);
$types[$type->getId()] = $type->getAlias();
}
natcasesort($types);
$options = array();