2003-12-21 14:52:23 +00:00
< ? php
/*
$Id $
This code is part of LDAP Account Manager ( http :// www . sourceforge . net / projects / lam )
Copyright ( C ) 2003 Tilo Lutz
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
*/
2004-06-08 18:54:37 +00:00
class account extends baseModule {
2004-06-13 19:58:58 +00:00
/**
* Returns meta data that is interpreted by parent class
*
* @ return array array with meta data
*/
function get_metaData () {
$return = array ();
// manages host accounts
$return [ " account_types " ] = array ( " host " );
2004-06-14 16:05:36 +00:00
// alias name
$return [ " alias " ] = _ ( 'Account' );
2004-06-20 17:32:02 +00:00
// module dependencies
$return [ 'dependencies' ] = array ( 'depends' => array (), 'conflicts' => array ( 'inetOrgPerson' ));
2004-08-17 15:16:17 +00:00
// available PDF fields
$return [ 'PDF_fields' ] = array ( 'description' );
2004-09-08 17:39:06 +00:00
// help Entries
$return [ 'help' ] = array ( 'description' => array ( " ext " => " FALSE " , " Headline " => _ ( " Gecos " ), " Text " => _ ( " Host description. If left empty host name will be used. " )));
2004-06-13 19:58:58 +00:00
return $return ;
}
2003-12-21 14:52:23 +00:00
// Constructor
2004-06-08 18:54:37 +00:00
function init ( $base ) {
2004-09-01 20:53:06 +00:00
// call parent init
parent :: init ( $base );
2003-12-21 14:52:23 +00:00
}
2004-09-28 16:46:53 +00:00
/** this functin fills the error message array with messages
**/
function load_Messages () {
}
2003-12-27 11:21:00 +00:00
/* This function returns true if all required attributes from other
* modules are set . This is required to prevent undefined states
*/
2003-12-21 14:52:23 +00:00
function module_ready () {
return true ;
}
2004-02-09 18:11:01 +00:00
/* This functions return true
* if all needed settings are done
*/
function module_complete () {
if ( ! $this -> module_ready ()) return false ;
return true ;
}
2003-12-27 11:21:00 +00:00
/* This function returns a list of all html - pages in module
* This is usefull for mass upload and pdf - files
* because lam can walk trough all pages itself and do some
* error checkings
*/
function pages () {
return array ( 'attributes' );
}
2003-12-30 15:36:30 +00:00
/* This function returns all ldap attributes
* which are part of account and returns
* also their values .
2003-12-21 14:52:23 +00:00
*/
2003-12-30 15:36:30 +00:00
function get_attributes () {
return $this -> attributes ;
2003-12-21 14:52:23 +00:00
}
/* This function loads all attributes into the object
* $attr is an array as it ' s retured from ldap_get_attributes
*/
function load_attributes ( $attr ) {
2004-09-26 13:48:52 +00:00
$this -> load_ldap_attributes ( $attr );
2003-12-21 14:52:23 +00:00
return 0 ;
}
2003-12-27 11:21:00 +00:00
/* This function returns an array with 4 entries :
* array ( DN1 ( 'add' => array ( $attr ), 'remove' => array ( $attr ), 'modify' => array ( $attr ), 'lamdaemon' => array ( cmds )), DN2 .... )
2003-12-21 14:52:23 +00:00
* DN is the DN to change . It may be possible to change several DNs ,
* e . g . create a new user and add him to some groups via attribute memberUid
* add are attributes which have to be added to ldap entry
* remove are attributes which have to be removed from ldap entry
2003-12-27 11:21:00 +00:00
* lamdaemon are lamdaemon commands to modify homedir , quotas , ...
2003-12-21 14:52:23 +00:00
*/
function save_attributes () {
2003-12-27 11:21:00 +00:00
// Get easy attributes
2003-12-21 14:52:23 +00:00
$return = $_SESSION [ $this -> base ] -> save_module_attributes ( $this -> attributes , $this -> orig );
2003-12-27 11:21:00 +00:00
// Return attributes
2003-12-21 14:52:23 +00:00
return $return ;
}
2003-12-30 15:36:30 +00:00
function delete_attributes ( $post ) {
2004-01-10 11:47:48 +00:00
return 0 ;
2003-12-30 15:36:30 +00:00
}
/* Write variables into object and do some regexp checks
2003-12-21 14:52:23 +00:00
*/
2004-01-18 12:52:52 +00:00
function proccess_attributes ( $post , $profile = false ) {
2003-12-30 15:36:30 +00:00
// Load attributes
$this -> attributes [ 'description' ][ 0 ] = $post [ 'description' ];
return 0 ;
2003-12-21 14:52:23 +00:00
}
/* This function will create the html - page
* to show a page with all attributes .
* It will output a complete html - table
*/
2004-01-18 12:52:52 +00:00
function display_html_attributes ( $post , $profile = false ) {
$return [] = array ( 0 => array ( 'kind' => 'text' , 'text' => _ ( 'Description' ) ),
1 => array ( 'kind' => 'input' , 'name' => 'description' , 'type' => 'text' , 'size' => '30' ,
'maxlength' => '255' , 'value' => $this -> attributes [ 'description' ][ 0 ] ),
2 => array ( 'kind' => 'help' , 'value' => 'description' ));
return $return ;
2003-12-21 14:52:23 +00:00
}
2004-01-18 12:52:52 +00:00
function display_html_delete ( $post , $profile = false ) {
2003-12-30 15:36:30 +00:00
return 0 ;
}
2004-06-03 14:26:48 +00:00
2004-08-17 15:16:17 +00:00
/*
* ( non - PHPDoc )
* @ see baseModule #get_pdfEntries
*/
2004-05-29 19:20:28 +00:00
function get_pdfEntries ( $account_type = " user " ) {
return array ( 'account_description' => array ( '<block><key>' . _ ( 'Description' ) . '</key><value>' . $this -> attributes [ 'description' ][ 0 ] . '</value></block>' ));
2004-05-24 21:39:57 +00:00
}
2004-03-14 17:33:05 +00:00
2004-03-09 12:03:39 +00:00
}
2003-12-21 14:52:23 +00:00
?>