From: opensides Date: Thu, 27 Mar 2008 21:34:35 +0000 (+0000) Subject: - Removed dir suite to cleanup X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e7f157ba8e9b2052338570efdf767a6fdde19749;p=gosa.git - Removed dir suite to cleanup git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5-plugins@10039 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/sudo-ldap/src/class_sudoldap.inc b/sudo-ldap/src/class_sudoldap.inc deleted file mode 100644 index 7090d93a8..000000000 --- a/sudo-ldap/src/class_sudoldap.inc +++ /dev/null @@ -1,183 +0,0 @@ - - \version 1.00 - \date 22.03.2008 - - This class provides the functionality to read and write all attributes - relevant for sudo-ldap from/to the LDAP. - */ - -class sudoldap extends plugin -{ - /* Definitions */ - var $plHeadline = "sudo-ldap"; - var $plDescription = "This does something"; - - /* Plugin specific values */ - var $attributes = array( "cn", - "description", - "sudoUser", - "sudoHost", - "sudoCommand", - "sudoRunAs", - "sudoOption"); - - var $objectclasses = array("sudoRole"); - var $Roles = array(); - var $dialog = NULL; - - /* constructor, if 'dn' is set, the node loads the given - 'dn' from LDAP */ - function sudoldap ($config, $dn= NULL, $parent= NULL){ - /* Configuration is fine, allways */ - $this->config= $config; - /* Load bases attributes */ - plugin::plugin($config, $dn, $parent); - $ldap= $this->config->get_ldap_link(); - } // function - - /* execute generates the html output for this node */ - function execute($isCopyPaste = false){ - /* Call parent execute */ - plugin::execute(); - $display= ""; - $smarty= get_smarty(); - $this->Roles = $this->getRoles(); - - /* Edited or Added zone - */ - if((isset($_POST['SaveRoleChanges'])) && is_object($this->dialog)){ - $this->dialog->save_object(); - - /* Check for errors - */ - if(count($this->dialog->check())){ - foreach($this->dialog->check() as $msgs){ - print_red($msgs); - } - }else{ - /* add new/edited zone - */ - $ret = $this->dialog->save(); - //if(!$this->dialog->isNew){ - // unset($this->Roles[$this->dialog->OldRoleName]); - //} - $this->Roles[$ret['cn']] = $ret; - $this->dialog = NULL; - } - } - - /* Cancel zone edit / new - */ - if(isset($_POST['CancelRoleChanges'])){ - $this->dialog = NULL; - } - - /* Add empty new zone - */ - //if(isset($_POST['AddRole']) && chkacl($this->acl,"sudoldap") == ""){ - if(isset($_POST['AddRole'])){ - $this->dialog = new sudoldapEditRole($this->config); - } - - /* Check for edit role request - */ - $once = false; - foreach( $_POST as $name => $value){ - - /* check all post for edit request - */ - - //if(preg_match("/^editRole_/",$name)&&!$once - // && chkacl($this->acl,"sudoldap") == ""){ - if(preg_match("/^editRole_/",$name)&&!$once){ - $once =true; - $tmp = preg_replace("/^editRole_/","",$name); - $tmp = base64_decode(preg_replace("/_.*$/","",$tmp)); - $this->dialog= new sudoldapeditRole($this->config, - $this->dn, - $this->Roles[$tmp]); - } // if () - - /* check posts for delete zone - */ - - //if(preg_match("/^delRole_/",$name)&&!$once - // && chkacl($this->acl,"sudoldap") == ""){ - if(preg_match("/^delRole_/",$name)&&!$once){ - $once =true; - $tmp = preg_replace("/^delRole_/","",$name); - $tmp = base64_decode(preg_replace("/_.*$/","",$tmp)); - - /* Initiate deletion - */ - - $this->RemoveRole($tmp); - } // if () - - } // foreach() - - /* Show dialog - */ - if($this->dialog!= NULL){ - $this->dialog->save_object(); - $this->dialog->parent = $this; - return($this->dialog->execute()); - } - - $RoleList = new divSelectBox("sudoRoles"); - $RoleList->SetHeight(300); - $editImg = " - "; - - foreach($this->Roles as $role => $values ){ - $link = "%s"; - $RoleList->AddEntry( - array( - array("string" => sprintf($link,base64_encode($role),$role)), - array("string" => str_replace("%s",base64_encode($role),$editImg)) - ) - ); - } // foreach() - - $smarty->assign("sudoldapACL",chkacl($this->acl,"sudoldap")); - $smarty->assign("RoleList",$RoleList->DrawList()); - - $display.= $smarty->fetch(get_template_path('sudoldap.tpl', TRUE)); - - return($display); - } // function - - function getRoles(){ - $ret = array(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=sudoRole)",$this->attributes); - while ($attrs= $ldap->fetch()){ - $cn= $attrs['cn'][0]; - foreach($this->attributes as $value){ - if(isset($attrs[$value])){ - $ret[$cn][$value] = $attrs[$value][0]; - } // if() - } // foreach() - } // while() - return($ret); - } - - function RemoveRole($cn){ - if($cn!=""){ - $ldap= $this->config->get_ldap_link(); - $dn = "cn=".$cn.",ou=SUDOers,".$this->config->current['BASE']; - $ldap->cd($dn); - $ldap->rmdir_recursive($dn); - show_ldap_error($ldap->get_error(), _("Removing DNS entries failed")); - unset($this->Roles[$cn]); - } // if() - } // function - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/sudo-ldap/src/class_sudoldapEditRole.inc b/sudo-ldap/src/class_sudoldapEditRole.inc deleted file mode 100644 index 64f0761a8..000000000 --- a/sudo-ldap/src/class_sudoldapEditRole.inc +++ /dev/null @@ -1,108 +0,0 @@ -isNew = true; - }else{ - $this->isNew = false; - foreach($this->attributes as $value){ - if(isset($attrs[$value])){ - $this->$value = $attrs[$value]; - } - } - } - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - - /* Fill templating stuff */ - $smarty= get_smarty(); - $display= ""; - - $smarty->assign("cn", $this->cn); - $smarty->assign("description", $this->description); - $smarty->assign("sudoUser", $this->sudoUser); - $smarty->assign("sudoHost", $this->sudoHost); - $smarty->assign("sudoCommand", $this->sudoCommand); - $smarty->assign("sudoRunAs", $this->sudoRunAs); - $smarty->assign("sudoOption", $this->sudoOption); - - /* Display template */ - $display.= $smarty->fetch( - get_template_path('sudoldapeditrole.tpl', TRUE)); - return($display); - } - - /* Save data to object */ - function save_object() - { - //plugin::save_object(); - foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ - $this->$attr = $_POST[$attr]; - } - } - } - - - /* Check supplied data */ - function check() - { - } - - - /* Save to LDAP */ - function save() - { - plugin::save(); - $ldap= $this->config->get_ldap_link(); - - $this->dn = "cn=".$this->cn.",ou=SUDOers,".$this->config->current['BASE']; - $this->attrs['objectClass'] = array("sudoRole"); - - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); - $ldap->cd($this->dn); - $ldap->add($this->attrs); - - /* Display errors - */ - if($ldap->get_error() != "Success"){ - show_ldap_error("Record:".$ldap->get_error(), _("Saving failed!")); - } - } - - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/sudo-ldap/src/main.inc b/sudo-ldap/src/main.inc deleted file mode 100644 index 1d57e66ed..000000000 --- a/sudo-ldap/src/main.inc +++ /dev/null @@ -1,111 +0,0 @@ - - - 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 - */ - -/* Clear display */ -$display= ""; - -if (!$remove_lock){ - - /* Reset requested? */ - if (isset($_POST['edit_cancel']) || - (isset($_GET['reset']) && $_GET['reset'] == 1)){ - - del_lock ($ui->dn); - sess_del ('edit'); - sess_del ('sudoldap'); - } - - /* Create sudoldap object on demand */ - if (!isset($_SESSION['sudoldap']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ - $_SESSION['sudoldap']= new sudoldap ($config, $ui->dn); - } - $sudoldap= $_SESSION['sudoldap']; - - /* save changes back to object */ - if (isset ($_SESSION['edit'])){ - $sudoldap->save_object (); - } - - /* Enter edit mode? */ - if ((isset($_POST['edit'])) && (!isset( $_SESSION['edit']))){ - - /* Check locking */ - if (($username= get_lock($ui->dn)) != ""){ - $_SESSION['back_plugin']= $plug; - gen_locked_message ($username, $ui->dn); - exit (); - } - - /* Lock the current entry */ - add_lock ($ui->dn, $ui->dn); - $_SESSION['dn']= $ui->dn; - $_SESSION['edit']= TRUE; - } - - /* Adjust acl's to mode */ - if (isset($_SESSION['edit'])){ - $acl= get_permissions ($ui->dn, $ui->subtreeACL); - $sudoldap->acl= get_module_permission($acl, "sudoldap", $ui->dn); - } else { - $acl= get_permissions ($ui->dn, $ui->subtreeACL); - $editacl= get_module_permission($acl, "sudoldap", $ui->dn); - $sudoldap->acl= "#none#"; - } - - /* save changes to LDAP and disable edit mode */ - $info= ""; - if (isset($_POST['edit_finish'])){ - - /* Perform checks */ - $message= $sudoldap->check (); - - /* No errors, save object */ - if (count ($message) == 0){ - $sudoldap->save (); - gosa_log ("SUDO/ldap object'".$ui->dn."' has been saved"); - $sudoldap->acl= "#none#"; - $editacl= get_module_permission($acl, "sudoldap", $ui->dn); - del_lock ($ui->dn); - sess_del ('edit'); - - /* Remove from session */ - sess_del ('sudoldap'); - } else { - /* Errors found, show message */ - show_errors ($message); - } - } - - /* Execute formular */ - $display.= $sudoldap->execute (); - - /* Store changes in session */ - if (isset ($_SESSION['edit'])){ - $_SESSION['sudoldap']= $sudoldap; - } - - /* Page header*/ - $display= print_header(get_template_path('images/posix.png'), - _("sudo-ldap"), $info).$display; - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/sudo-ldap/src/sudoldap.tpl b/sudo-ldap/src/sudoldap.tpl deleted file mode 100644 index 0f609735a..000000000 --- a/sudo-ldap/src/sudoldap.tpl +++ /dev/null @@ -1,17 +0,0 @@ - - - - -
-

{t}Sudo Roles{/t}

- {$RoleList} - - -
- diff --git a/sudo-ldap/src/sudoldapeditrole.tpl b/sudo-ldap/src/sudoldapeditrole.tpl deleted file mode 100644 index d4f42c61a..000000000 --- a/sudo-ldap/src/sudoldapeditrole.tpl +++ /dev/null @@ -1,42 +0,0 @@ -

{t}sudo-ldap role{/t}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{t}cn{/t}{$must}
{t}description{/t}{$must}
{t}sudoUser{/t}{$must}
{t}sudoHost{/t}{$must}
{t}sudoCommand{/t}{$must}
{t}sudoRunAs{/t}{$must}
{t}sudoOption{/t}{$must}
-
-

- - -

-
-