You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
(23) |
May
(11) |
Jun
(24) |
Jul
(18) |
Aug
(7) |
Sep
(6) |
Oct
(34) |
Nov
(6) |
Dec
(23) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(16) |
Sep
(12) |
Oct
(2) |
Nov
|
Dec
(6) |
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
|
From: <dwe...@us...> - 2007-08-13 21:14:32
|
Revision: 143 http://elma.svn.sourceforge.net/elma/?rev=143&view=rev Author: dweuthen Date: 2007-08-13 14:14:27 -0700 (Mon, 13 Aug 2007) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/includes/sieve.inc.php Removed Paths: ------------- trunk/lib/sieve/.vacation.inc.php.swp Modified: trunk/includes/sieve.inc.php =================================================================== --- trunk/includes/sieve.inc.php 2007-08-13 21:12:51 UTC (rev 142) +++ trunk/includes/sieve.inc.php 2007-08-13 21:14:27 UTC (rev 143) @@ -6,7 +6,6 @@ } function createSieveFilter ( $sieveFilter, $sieveValues ) { - my_print_r($sieveFilter); foreach ( $sieveValues as $keyword => $value) { $sieveFilter["rules"] = str_replace("%$keyword%", $value, $sieveFilter["rules"]); } Deleted: trunk/lib/sieve/.vacation.inc.php.swp =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dwe...@us...> - 2007-08-13 21:12:53
|
Revision: 142 http://elma.svn.sourceforge.net/elma/?rev=142&view=rev Author: dweuthen Date: 2007-08-13 14:12:51 -0700 (Mon, 13 Aug 2007) Log Message: ----------- added sieve filter functionality for vacation settings. this implementation is to be considered just a poor draft. changes may occur soon. Modified Paths: -------------- trunk/index.php trunk/modules/content_user_edit.php trunk/templates/simple/content_user_edit.tpl Added Paths: ----------- trunk/includes/sieve.inc.php trunk/lib/ trunk/lib/sieve/ trunk/lib/sieve/.vacation.inc.php.swp trunk/lib/sieve/initSieve.php trunk/sievetest.php Added: trunk/includes/sieve.inc.php =================================================================== --- trunk/includes/sieve.inc.php (rev 0) +++ trunk/includes/sieve.inc.php 2007-08-13 21:12:51 UTC (rev 142) @@ -0,0 +1,63 @@ +<?php + +function loadSieveTemplates() { + include("lib/sieve/initSieve.php"); + return $sieveFilter; +} + +function createSieveFilter ( $sieveFilter, $sieveValues ) { + my_print_r($sieveFilter); + foreach ( $sieveValues as $keyword => $value) { + $sieveFilter["rules"] = str_replace("%$keyword%", $value, $sieveFilter["rules"]); + } + + $requireValues .= implode(",",$sieveFilter["require"]); + $sieveFilterScript = "require [$requireValues];\n"; + $sieveFilterScript .= implode("\n",$sieveFilter["rules"]); + return (sieveEscapeChars($sieveFilterScript)); +} + +function parseSieveFilter ( $sieveFilter ) { + $lines = array(); + $lines = preg_split("/\n/",$sieveFilter); + $line = array_shift($lines); + while ( isset($line) ) { + if ( preg_match('/^(.*)vacation :days 7 :addresses "(.*)" "(.*)";/i',$line,$values) ) { + $sieveValues = array( STATUS => sieveUnescapeChars($values[1]), + RECIPIENT => sieveUnescapeChars($values[2]), + MESSAGE => sieveUnescapeChars($values[3])); + } + $line = array_shift($lines); + } + return $sieveValues; +} + +/** +* Make a string safe for the encoded index. Replace CRLFs and & chars. +* +* @param string $string The string to make safe +* @return string The safe string +*/ +function sieveEscapeChars($string) +{ + $string = preg_replace("/\r\n/", "\\n", $string); + $string = preg_replace("/&/", "\&", $string); + return $string; +} + +/** +* Unescape a string made safe by escapeChars(). +* +* @param string $string The string to unescape +* @return string The unescaped string +*/ +function sieveUnescapeChars($string) +{ + $string = preg_replace("/\\\\n/", "\r\n", $string); + $string = preg_replace("/\\\&/", "&", $string); + return $string; +} + + +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: +?> Modified: trunk/index.php =================================================================== --- trunk/index.php 2007-08-13 15:34:10 UTC (rev 141) +++ trunk/index.php 2007-08-13 21:12:51 UTC (rev 142) @@ -37,6 +37,7 @@ require("includes/ldap_functions.inc.php"); require("includes/my_functions.inc.php"); require("includes/crypt.inc.php"); +require("includes/sieve.inc.php"); if (isset($_POST["module"])) $module = $_POST["module"]; Added: trunk/lib/sieve/.vacation.inc.php.swp =================================================================== (Binary files differ) Property changes on: trunk/lib/sieve/.vacation.inc.php.swp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/sieve/initSieve.php =================================================================== --- trunk/lib/sieve/initSieve.php (rev 0) +++ trunk/lib/sieve/initSieve.php 2007-08-13 21:12:51 UTC (rev 142) @@ -0,0 +1,9 @@ +<?php + +$sieveFilter["require"] = array(); +$sieveFilter["rules"] = array(); + +array_push($sieveFilter["require"],"\"vacation\""); +array_push($sieveFilter["rules"], "%STATUS%vacation :days 7 :addresses \"%RECIPIENT%\" \"%MESSAGE%\";"); + +?> Modified: trunk/modules/content_user_edit.php =================================================================== --- trunk/modules/content_user_edit.php 2007-08-13 15:34:10 UTC (rev 141) +++ trunk/modules/content_user_edit.php 2007-08-13 21:12:51 UTC (rev 142) @@ -56,6 +56,18 @@ // new user created or existing user modified if (isset($_POST["submit"])) { + if (isset($_POST["nlo_vacationstatus"])) { + $sieveFilter = loadSieveTemplates(); + $sieveValues = array( STATUS => "", + RECIPIENT => $_POST["uid"]."@".$domain, + MESSAGE => $_POST["nlo_vacationmessage"]); + } else { + $sieveFilter = loadSieveTemplates(); + $sieveValues = array( STATUS => "#", + RECIPIENT => $_POST["uid"]."@".$domain, + MESSAGE => $_POST["nlo_vacationmessage"]); + } + // remove all non LDAP objects from submited form // an the submit and mode value $my_user = remove_key_by_str($_POST,"nlo_"); @@ -67,18 +79,10 @@ $my_user["mailstatus"] = "FALSE"; } - if (isset($_POST["vacationstatus"])) { - $my_user["vacationstatus"] = "TRUE"; - } else { - $my_user["vacationstatus"] = "FALSE"; - } + $my_user["mailSieveFilter"] = createSieveFilter( $sieveFilter, $sieveValues ); - if ($my_user["vacationmessage"] == "") { - unset ($my_user["vacationmessage"]); - } - $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); - + my_print_r($my_user); $validation_errors = validate_user($my_user); if (count($validation_errors) == 0) { $this->ldap->modifyUser($domain,$my_user); @@ -100,8 +104,11 @@ if ( $user == "new" ) { $this->smarty->assign("mode","add"); } else { + $my_user = $this->ldap->getUser($domain,$user); + $sieveValues = parseSieveFilter($my_user["mailsievefilter"][0]); $this->smarty->assign("mode","modify"); - $this->smarty->assign("user",$this->ldap->getUser($domain,$user)); + $this->smarty->assign("user",$my_user); + $this->smarty->assign("vacationsettings",$sieveValues); } } Added: trunk/sievetest.php =================================================================== --- trunk/sievetest.php (rev 0) +++ trunk/sievetest.php 2007-08-13 21:12:51 UTC (rev 142) @@ -0,0 +1,21 @@ +<?php + +require("includes/config.inc.php"); +require("includes/acl.inc.php"); +require("includes/smarty.inc.php"); +require("includes/gettext.inc.php"); +require("includes/ldap_functions.inc.php"); +require("includes/my_functions.inc.php"); +require("includes/crypt.inc.php"); +require("includes/sieve.inc.php"); + +$sieveValues = array( RECIPIENT => "dw...@me...", + MESSAGE => "Dies ist ein test"); + +$sieveFilterScript = createSieveFilter( $sieveFilter, $sieveValues ); + +my_print_r($sieveFilterScript); + + +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: +?> Modified: trunk/templates/simple/content_user_edit.tpl =================================================================== --- trunk/templates/simple/content_user_edit.tpl 2007-08-13 15:34:10 UTC (rev 141) +++ trunk/templates/simple/content_user_edit.tpl 2007-08-13 21:12:51 UTC (rev 142) @@ -46,7 +46,7 @@ {t}Vacant?{/t} </td> <td> - <input type="checkbox" name="vacationstatus" {if $user.vacationstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + <input type="checkbox" name="nlo_vacationstatus" {if $vacationsettings.STATUS eq "#"}{else}checked="checked"{/if} /> </td> </tr> <tr> @@ -54,7 +54,7 @@ {t}Message:{/t} </td> <td> - <textarea name="vacationmessage">{$user.vacationmessage.0}</textarea> + <textarea name="nlo_vacationmessage" cols="60" rows="5">{$vacationsettings.MESSAGE}</textarea> </td> </tr> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dwe...@us...> - 2007-08-13 15:34:25
|
Revision: 141 http://elma.svn.sourceforge.net/elma/?rev=141&view=rev Author: dweuthen Date: 2007-08-13 08:34:10 -0700 (Mon, 13 Aug 2007) Log Message: ----------- renamed file Added Paths: ----------- trunk/doc/examples/ldap/elma-0.3.schema Removed Paths: ------------- trunk/doc/examples/ldap/elma-0.2.schema Deleted: trunk/doc/examples/ldap/elma-0.2.schema =================================================================== --- trunk/doc/examples/ldap/elma-0.2.schema 2007-08-13 15:31:44 UTC (rev 140) +++ trunk/doc/examples/ldap/elma-0.2.schema 2007-08-13 15:34:10 UTC (rev 141) @@ -1,51 +0,0 @@ -# common Attributes -attributetype ( 1.3.6.1.4.1.25287.1.1.2.1 - NAME 'mailStatus' - DESC 'Enable/Disable domain, user or alias.' - EQUALITY booleanMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 - SINGLE-VALUE ) - -attributetype ( 1.3.6.1.4.1.25287.1.1.2.2 - NAME ( 'mailStorageserver' ) - DESC 'FQHN of mailstorage host' - EQUALITY caseIgnoreIA5Match - SUBSTR caseIgnoreIA5SubstringsMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) - -attributetype ( 1.3.6.1.4.1.25287.1.1.1.3 - NAME 'mailSieveFilter' - DESC 'filterscript written in Sieve' - SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 - SINGLE-VALUE ) - -# mailDomain -objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 - NAME 'mailDomain' SUP domain - DESC 'Mail Domain' STRUCTURAL - MUST ( dc $ mailStatus $ mailStorageserver) - MAY ( mailSieveFilter ) ) - -# mailUser -attributetype ( 1.3.6.1.4.1.25287.1.1.2.201 - NAME 'clearpassword' - DESC 'cleartext password, e.g. for CRAM-MD5' SUP name - EQUALITY caseExactMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE) - -objectclass ( 1.3.6.1.4.1.25287.1.1.1.200 - NAME 'mailUser' - DESC 'Mail router user' SUP person STRUCTURAL - MUST ( uid $ userPassword $ homeDirectory $ mailStatus $ mailStorageserver) - MAY ( clearpassword $ mailSieveFilter ) ) - -# mailAlias -attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' - DESC 'Mail router aliased name' SUP name ) - -objectclass ( 1.3.6.1.4.1.25287.1.1.2.300 NAME 'mailAlias' - DESC 'Mail alias' SUP top STRUCTURAL - MUST ( uid $ mailAliasedName ) - MAY ( mailStatus) ) - - Copied: trunk/doc/examples/ldap/elma-0.3.schema (from rev 140, trunk/doc/examples/ldap/elma-0.2.schema) =================================================================== --- trunk/doc/examples/ldap/elma-0.3.schema (rev 0) +++ trunk/doc/examples/ldap/elma-0.3.schema 2007-08-13 15:34:10 UTC (rev 141) @@ -0,0 +1,51 @@ +# common Attributes +attributetype ( 1.3.6.1.4.1.25287.1.1.2.1 + NAME 'mailStatus' + DESC 'Enable/Disable domain, user or alias.' + EQUALITY booleanMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 + SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.25287.1.1.2.2 + NAME ( 'mailStorageserver' ) + DESC 'FQHN of mailstorage host' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.25287.1.1.1.3 + NAME 'mailSieveFilter' + DESC 'filterscript written in Sieve' + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE ) + +# mailDomain +objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 + NAME 'mailDomain' SUP domain + DESC 'Mail Domain' STRUCTURAL + MUST ( dc $ mailStatus $ mailStorageserver) + MAY ( mailSieveFilter ) ) + +# mailUser +attributetype ( 1.3.6.1.4.1.25287.1.1.2.201 + NAME 'clearpassword' + DESC 'cleartext password, e.g. for CRAM-MD5' SUP name + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE) + +objectclass ( 1.3.6.1.4.1.25287.1.1.1.200 + NAME 'mailUser' + DESC 'Mail router user' SUP person STRUCTURAL + MUST ( uid $ userPassword $ homeDirectory $ mailStatus $ mailStorageserver) + MAY ( clearpassword $ mailSieveFilter ) ) + +# mailAlias +attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' + DESC 'Mail router aliased name' SUP name ) + +objectclass ( 1.3.6.1.4.1.25287.1.1.2.300 NAME 'mailAlias' + DESC 'Mail alias' SUP top STRUCTURAL + MUST ( uid $ mailAliasedName ) + MAY ( mailStatus) ) + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dwe...@us...> - 2007-08-13 15:32:22
|
Revision: 140 http://elma.svn.sourceforge.net/elma/?rev=140&view=rev Author: dweuthen Date: 2007-08-13 08:31:44 -0700 (Mon, 13 Aug 2007) Log Message: ----------- removed vacationStatus and vacationMessage added mailSieveFilter Modified Paths: -------------- trunk/doc/examples/ldap/elma-0.2.schema Modified: trunk/doc/examples/ldap/elma-0.2.schema =================================================================== --- trunk/doc/examples/ldap/elma-0.2.schema 2007-07-18 11:09:41 UTC (rev 139) +++ trunk/doc/examples/ldap/elma-0.2.schema 2007-08-13 15:31:44 UTC (rev 140) @@ -8,21 +8,14 @@ attributetype ( 1.3.6.1.4.1.25287.1.1.2.2 NAME ( 'mailStorageserver' ) - DESC 'fqhn of mailstorage host' + DESC 'FQHN of mailstorage host' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) -attributetype ( 1.3.6.1.4.1.25287.1.1.2.3 - NAME 'vacationStatus' - DESC 'Enable/Disable vacation for user or alias.' - EQUALITY booleanMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 - SINGLE-VALUE ) - -attributetype ( 1.3.6.1.4.1.25287.1.1.2.4 - NAME 'vacationMessage' - DESC 'UTF-8-Message, sent as response when vacationStatus is TRUE' +attributetype ( 1.3.6.1.4.1.25287.1.1.1.3 + NAME 'mailSieveFilter' + DESC 'filterscript written in Sieve' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) @@ -30,7 +23,8 @@ objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 NAME 'mailDomain' SUP domain DESC 'Mail Domain' STRUCTURAL - MUST ( dc $ mailStatus $ mailStorageserver) ) + MUST ( dc $ mailStatus $ mailStorageserver) + MAY ( mailSieveFilter ) ) # mailUser attributetype ( 1.3.6.1.4.1.25287.1.1.2.201 @@ -43,7 +37,7 @@ NAME 'mailUser' DESC 'Mail router user' SUP person STRUCTURAL MUST ( uid $ userPassword $ homeDirectory $ mailStatus $ mailStorageserver) - MAY ( clearpassword $ vacationStatus $ vacationMessage ) ) + MAY ( clearpassword $ mailSieveFilter ) ) # mailAlias attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ad...@us...> - 2007-07-18 11:09:43
|
Revision: 139 http://elma.svn.sourceforge.net/elma/?rev=139&view=rev Author: adan0s Date: 2007-07-18 04:09:41 -0700 (Wed, 18 Jul 2007) Log Message: ----------- - added vacation messages for aliases - empty vacation message will not be saved Modified Paths: -------------- trunk/modules/content_alias_edit.php trunk/modules/content_user_edit.php trunk/templates/simple/content_alias_edit.tpl Modified: trunk/modules/content_alias_edit.php =================================================================== --- trunk/modules/content_alias_edit.php 2007-07-18 10:08:22 UTC (rev 138) +++ trunk/modules/content_alias_edit.php 2007-07-18 11:09:41 UTC (rev 139) @@ -66,7 +66,17 @@ } else { $my_alias["mailstatus"] = "FALSE"; } + + if (isset($_POST["vacationstatus"])) { + $my_alias["vacationstatus"] = "TRUE"; + } else { + $my_alias["vacationstatus"] = "FALSE"; + } + if ($my_alias["vacationmessage"] == "") { + unset ($my_alias["vacationmessage"]); + } + $my_alias["mailaliasedname"] = explode("\n", $_POST['nlo_mailaliasedname']); $validation_errors = validate_alias($my_alias); Modified: trunk/modules/content_user_edit.php =================================================================== --- trunk/modules/content_user_edit.php 2007-07-18 10:08:22 UTC (rev 138) +++ trunk/modules/content_user_edit.php 2007-07-18 11:09:41 UTC (rev 139) @@ -73,6 +73,10 @@ $my_user["vacationstatus"] = "FALSE"; } + if ($my_user["vacationmessage"] == "") { + unset ($my_user["vacationmessage"]); + } + $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); $validation_errors = validate_user($my_user); Modified: trunk/templates/simple/content_alias_edit.tpl =================================================================== --- trunk/templates/simple/content_alias_edit.tpl 2007-07-18 10:08:22 UTC (rev 138) +++ trunk/templates/simple/content_alias_edit.tpl 2007-07-18 11:09:41 UTC (rev 139) @@ -34,6 +34,28 @@ <input type="checkbox" name="mailstatus" {if $alias.mailstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> </td> </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> + <td> + {t}Vacant?{/t} + </td> + <td> + <input type="checkbox" name="vacationstatus" {if $alias.vacationstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + </td> + </tr> + <tr> + <td> + {t}Message:{/t} + </td> + <td> + <textarea name="vacationmessage">{$alias.vacationmessage.0}</textarea> + </td> + </tr> + <tr> <tr> <td colspan="2"> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ad...@us...> - 2007-07-18 10:08:24
|
Revision: 138 http://elma.svn.sourceforge.net/elma/?rev=138&view=rev Author: adan0s Date: 2007-07-18 03:08:22 -0700 (Wed, 18 Jul 2007) Log Message: ----------- - fixed some small issues that occured since some variables have been renamed - added vacation settings, message is saved into ldap atm Modified Paths: -------------- trunk/includes/ldap_functions.inc.php trunk/modules/content_user_edit.php trunk/modules/content_user_new.php trunk/templates/simple/content_user_edit.tpl Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-17 10:11:13 UTC (rev 137) +++ trunk/includes/ldap_functions.inc.php 2007-07-18 10:08:22 UTC (rev 138) @@ -146,6 +146,7 @@ */ function addDomain ( $domain , $admins ) { $domain["objectclass"] = "mailDomain"; + ldap_add($this->cid, "dc=".$domain['dc'].",".LDAP_DOMAINS_ROOT_DN, $domain); if ( ldap_errno($this->cid) !== 0 ) { @@ -160,7 +161,7 @@ $group["cn"] = "admingroup"; $group["objectclass"] = "groupOfNames"; $group["member"] = $admins; - + ldap_add($this->cid, "cn=".$group["cn"].",dc=".$domain['dc'].",".LDAP_DOMAINS_ROOT_DN, $group); return $result; } @@ -329,7 +330,7 @@ } } - ldap_delete($this->cid, "uid=".$user.",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN); + ldap_delete($this->cid, "uid=".$user_uid.",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -419,7 +420,7 @@ * @domain_dc string dc= value of a domain's DN * @alias_uid string uid= value of the alias's DN */ - function deleteAlias ( $domain, $alias_uid ) { + function deleteAlias ( $domain_dc, $alias_uid ) { ldap_delete($this->cid, "uid=".$alias_uid.",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN); if ( ldap_errno($this->cid) !== 0 ) Modified: trunk/modules/content_user_edit.php =================================================================== --- trunk/modules/content_user_edit.php 2007-07-17 10:11:13 UTC (rev 137) +++ trunk/modules/content_user_edit.php 2007-07-18 10:08:22 UTC (rev 138) @@ -60,7 +60,6 @@ // an the submit and mode value $my_user = remove_key_by_str($_POST,"nlo_"); unset($my_user["submit"]); - unset($my_user["mode"]); if (isset($_POST["mailstatus"])) { $my_user["mailstatus"] = "TRUE"; @@ -68,19 +67,17 @@ $my_user["mailstatus"] = "FALSE"; } + if (isset($_POST["vacationstatus"])) { + $my_user["vacationstatus"] = "TRUE"; + } else { + $my_user["vacationstatus"] = "FALSE"; + } + $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); $validation_errors = validate_user($my_user); if (count($validation_errors) == 0) { - switch ($_POST["mode"]) { - case "add": - $this->ldap->addUser($domain,$my_user); - break; - case "modify": - $this->ldap->modifyUser($domain,$my_user); - break; - } - + $this->ldap->modifyUser($domain,$my_user); $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { $this->smarty->assign("submit_status",$submit_status); Modified: trunk/modules/content_user_new.php =================================================================== --- trunk/modules/content_user_new.php 2007-07-17 10:11:13 UTC (rev 137) +++ trunk/modules/content_user_new.php 2007-07-18 10:08:22 UTC (rev 138) @@ -67,6 +67,8 @@ $my_user["mailstatus"] = "FALSE"; } + $my_user["vacationstatus"] = "FALSE"; + $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); $validation_errors = validate_user($my_user); Modified: trunk/templates/simple/content_user_edit.tpl =================================================================== --- trunk/templates/simple/content_user_edit.tpl 2007-07-17 10:11:13 UTC (rev 137) +++ trunk/templates/simple/content_user_edit.tpl 2007-07-18 10:08:22 UTC (rev 138) @@ -41,7 +41,28 @@ <hr/> </td> </tr> + <tr> + <td> + {t}Vacant?{/t} + </td> + <td> + <input type="checkbox" name="vacationstatus" {if $user.vacationstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + </td> + </tr> + <tr> + <td> + {t}Message:{/t} + </td> + <td> + <textarea name="vacationmessage">{$user.vacationmessage.0}</textarea> + </td> + </tr> <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> <td> {t}Password{/t} </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ad...@us...> - 2007-07-17 10:11:46
|
Revision: 137 http://elma.svn.sourceforge.net/elma/?rev=137&view=rev Author: adan0s Date: 2007-07-17 03:11:13 -0700 (Tue, 17 Jul 2007) Log Message: ----------- - added vacationStatus (bool) and vacationMessage (UTF-8) in ldap schema Modified Paths: -------------- trunk/doc/examples/ldap/elma-0.2.schema Modified: trunk/doc/examples/ldap/elma-0.2.schema =================================================================== --- trunk/doc/examples/ldap/elma-0.2.schema 2007-07-13 13:23:57 UTC (rev 136) +++ trunk/doc/examples/ldap/elma-0.2.schema 2007-07-17 10:11:13 UTC (rev 137) @@ -13,6 +13,19 @@ SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributetype ( 1.3.6.1.4.1.25287.1.1.2.3 + NAME 'vacationStatus' + DESC 'Enable/Disable vacation for user or alias.' + EQUALITY booleanMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 + SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.25287.1.1.2.4 + NAME 'vacationMessage' + DESC 'UTF-8-Message, sent as response when vacationStatus is TRUE' + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE ) + # mailDomain objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 NAME 'mailDomain' SUP domain @@ -30,7 +43,7 @@ NAME 'mailUser' DESC 'Mail router user' SUP person STRUCTURAL MUST ( uid $ userPassword $ homeDirectory $ mailStatus $ mailStorageserver) - MAY ( clearpassword) ) + MAY ( clearpassword $ vacationStatus $ vacationMessage ) ) # mailAlias attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-13 13:24:02
|
Revision: 136 http://elma.svn.sourceforge.net/elma/?rev=136&view=rev Author: tuxevara Date: 2007-07-13 06:23:57 -0700 (Fri, 13 Jul 2007) Log Message: ----------- more splitting up edit and new modules for domains, users and aliases Modified Paths: -------------- trunk/includes/acl.inc.php trunk/modules/content_alias_edit.php trunk/modules/content_domain_edit.php trunk/modules/content_domains_list.php trunk/modules/content_users_list.php trunk/templates/simple/content_alias_edit.tpl trunk/templates/simple/content_domains_list.tpl trunk/templates/simple/content_users_list.tpl Added Paths: ----------- trunk/modules/content_alias_new.php trunk/modules/content_domain_new.php trunk/modules/content_user_new.php trunk/templates/simple/content_alias_new.tpl Modified: trunk/includes/acl.inc.php =================================================================== --- trunk/includes/acl.inc.php 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/includes/acl.inc.php 2007-07-13 13:23:57 UTC (rev 136) @@ -2,8 +2,8 @@ // ACLs define ("ACL",serialize(array( - "systemadmin" => array("main","domains_list","domain_edit","domain_edit.mailstorageserver","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit","statistics"), - "domainadmin" => array("main","domains_list","domain_edit","users_list","user_edit","user_delete","alias_edit","alias_delete","statistics"), + "systemadmin" => array("main","domains_list","domain_new","domain_new.mailstorageserver","domain_edit","domain_edit.mailstorageserver","domain_delete","users_list","user_new","user_edit","user_delete","alias_new","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit","statistics"), + "domainadmin" => array("main","domains_list","domain_edit","users_list","user_new","user_edit","user_delete","alias_new","alias_edit","alias_delete","statistics"), "user" => array("main") ))); Modified: trunk/modules/content_alias_edit.php =================================================================== --- trunk/modules/content_alias_edit.php 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/modules/content_alias_edit.php 2007-07-13 13:23:57 UTC (rev 136) @@ -60,7 +60,6 @@ // an the submit and mode value $my_alias = remove_key_by_str($_POST,"nlo_"); unset($my_alias["submit"]); - unset($my_alias["mode"]); if (isset($_POST["mailstatus"])) { $my_alias["mailstatus"] = "TRUE"; @@ -72,14 +71,8 @@ $validation_errors = validate_alias($my_alias); if (count($validation_errors) == 0) { - switch ($_POST["mode"]) { - case "add": - $this->ldap->addAlias($domain,$my_alias); - break; - case "modify": - $this->ldap->modifyAlias($domain,$my_alias); - break; - } + $this->ldap->modifyAlias($domain,$my_alias); + $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { $this->smarty->assign("submit_status",$submit_status); @@ -94,14 +87,7 @@ } else { $this->smarty->assign("submit_status",-1); } - - if ( $alias == "new" ) { - $this->smarty->assign("mode","add"); - } else { - $this->smarty->assign("mode","modify"); - $this->smarty->assign("alias",$this->ldap->getAlias($domain,$alias)); - } - + $this->smarty->assign("alias",$this->ldap->getAlias($domain,$alias)); } /** Added: trunk/modules/content_alias_new.php =================================================================== --- trunk/modules/content_alias_new.php (rev 0) +++ trunk/modules/content_alias_new.php 2007-07-13 13:23:57 UTC (rev 136) @@ -0,0 +1,104 @@ +<?php +/** + * @author Daniel Weuthen <da...@we...> + * @version $LastChangedRevision$ + * @package ELMA + * + * $Id$ + * $LastChangedBy$ + * + * ===================================================================== + * + * 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 Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * + * ===================================================================== + */ + +/** + * content alias new + * + * This content module is used for creating the alias new form and handling + * the submited data. + */ + +class content_alias_new extends module_base +{ + + /** + * Constructor of this class + */ + function content_alias_new() + { + parent::module_base(); + } + + /** + * This method is called after the constructor by the main page + */ + function proceed() + { + $alias = $_GET["alias"]; + $domain = $_GET["domain"]; + $this->smarty->assign("domain",$domain); + + // new alias created or existing alias altert + if (isset($_POST["submit"])) { + // remove all non LDAP objects from submited form + // an the submit and mode value + $my_alias = remove_key_by_str($_POST,"nlo_"); + unset($my_alias["submit"]); + + if (isset($_POST["mailstatus"])) { + $my_alias["mailstatus"] = "TRUE"; + } else { + $my_alias["mailstatus"] = "FALSE"; + } + + $my_alias["mailaliasedname"] = explode("\n", $_POST['nlo_mailaliasedname']); + + $validation_errors = validate_alias($my_alias); + if (count($validation_errors) == 0) { + $this->ldap->addAlias($domain,$my_alias); + + $submit_status = ldap_errno($this->ldap->cid); + if ($submit_status == "0") { + $this->smarty->assign("submit_status",$submit_status); + $alias = $my_alias["uid"]; + } else { + $this->smarty->assign("submit_status",ldap_err2str($submit_status)); + } + } else { + $this->smarty->assign("submit_status","Invalid Data"); + $this->smarty->assign("validation_errors",$validation_errors); + } + } else { + $this->smarty->assign("submit_status",-1); + } + } + + /** + * This method returns any content that should be echoed by the + * main page. + * + * @return string + */ + function getContent() + { + $_content = $this->smarty->fetch('content_alias_new.tpl'); + return $_content; + } +} +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Modified: trunk/modules/content_domain_edit.php =================================================================== --- trunk/modules/content_domain_edit.php 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/modules/content_domain_edit.php 2007-07-13 13:23:57 UTC (rev 136) @@ -54,7 +54,7 @@ $this->smarty->assign("domain",$domain); $this->smarty->assign("mailstorageservers",unserialize(MAILSTORAGESERVERS)); - // new domain created or existing domain altert + // existing domain altert if (isset($_POST["submit"])) { // remove all non LDAP objects from submited form // an the submit and mode value @@ -71,7 +71,6 @@ } unset($my_domain["submit"]); - unset($my_domain["mode"]); if (isset($_POST["mailstatus"])) { $my_domain["mailstatus"] = "TRUE"; @@ -81,38 +80,28 @@ $validation_errors = validate_domain($my_domain); if (count($validation_errors) == 0) { - switch ($_POST["mode"]) { - case "add": - if (!isset($admins)) { - $admins = array(); - } + $this->ldap->modifyDomain($my_domain); - $this->ldap->addDomain($my_domain, $admins); - break; - case "modify": - $this->ldap->modifyDomain($my_domain); + $admins_cur = $this->ldap->listAdminUsers($domain, TRUE); - $admins_cur = $this->ldap->listAdminUsers($domain, TRUE); + if (!isset($admins)) { + $admins = array(); + //array_push ($admins, LDAP_ADMIN_DN); + } - if (!isset($admins)) { - $admins = array(); - //array_push ($admins, LDAP_ADMIN_DN); - } + /* create array of new admins */ + $adminsadd = array_values(array_diff($admins,$admins_cur)); + + /* create array of removed admins */ + $adminsdel = array_values(array_diff($admins_cur,$admins)); - /* create array of new admins */ - $adminsadd = array_values(array_diff($admins,$admins_cur)); - - /* create array of removed admins */ - $adminsdel = array_values(array_diff($admins_cur,$admins)); - - if ( count($adminsadd) > 0 ) { - $this->ldap->addAdminUsers($domain, $adminsadd); - } - if ( count($adminsdel) > 0 ) { - $this->ldap->deleteAdminUsers($domain, $adminsdel); - } - break; + if ( count($adminsadd) > 0 ) { + $this->ldap->addAdminUsers($domain, $adminsadd); } + if ( count($adminsdel) > 0 ) { + $this->ldap->deleteAdminUsers($domain, $adminsdel); + } + $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { $this->smarty->assign("submit_status",$submit_status); @@ -128,56 +117,45 @@ $this->smarty->assign("submit_status",-1); } - if ($domain == "new") { - $this->smarty->assign("mode","add"); - $this->smarty->assign("domain",array()); - - $systemusers = $this->ldap->listSystemUsers(); - unset($systemusers["count"]); + $this->smarty->assign("domain",$this->ldap->getDomain($domain)); + + /* create a users/admin array from system- and mailusers + * and unset the count key from users/admins array + * to have useful arrays for the smarty output. + * serializing is neccessary to diff the multidimensional + * arrays. + */ - $this->smarty->assign("nonadmins", $systemusers); - } else { - $this->smarty->assign("mode","modify"); - $this->smarty->assign("domain",$this->ldap->getDomain($domain)); - - /* create a users/admin array from system- and mailusers - * and unset the count key from users/admins array - * to have useful arrays for the smarty output. - * serializing is neccessary to diff the multidimensional - * arrays. - */ + $systemusers = $this->ldap->listSystemUsers(); + if ( count($systemusers) == 0 ) $systemusers = array(); + unset($systemusers["count"]); - $systemusers = $this->ldap->listSystemUsers(); - if ( count($systemusers) == 0 ) $systemusers = array(); - unset($systemusers["count"]); + $mailusers = $this->ldap->listUsers($domain); + if ( count($mailusers) == 0 ) $mailusers = array(); + unset($mailusers["count"]); + + $nonadmins = array_merge($systemusers,$mailusers); + if ( count($nonadmins) == 0 ) $nonadmins = array(); + unset($nonadmins["count"]); - $mailusers = $this->ldap->listUsers($domain); - if ( count($mailusers) == 0 ) $mailusers = array(); - unset($mailusers["count"]); - - $nonadmins = array_merge($systemusers,$mailusers); - if ( count($nonadmins) == 0 ) $nonadmins = array(); - unset($nonadmins["count"]); + $admins = $this->ldap->listAdminUsers($domain); + if ( count($admins) == 0 ) $admins = array(); + unset($admins["count"]); - $admins = $this->ldap->listAdminUsers($domain); - if ( count($admins) == 0 ) $admins = array(); - unset($admins["count"]); + array_walk($nonadmins,'my_serialize'); + array_walk($admins,'my_serialize'); + + $nonadmins = array_values(array_diff($nonadmins,$admins)); - array_walk($nonadmins,'my_serialize'); - array_walk($admins,'my_serialize'); - - $nonadmins = array_values(array_diff($nonadmins,$admins)); + array_walk($admins,'my_unserialize'); + array_walk($nonadmins,'my_unserialize'); - array_walk($admins,'my_unserialize'); - array_walk($nonadmins,'my_unserialize'); + if (isset($admins)) { + $this->smarty->assign("admins", $admins); + } - if (isset($admins)) { - $this->smarty->assign("admins", $admins); - } - - if (isset($nonadmins)) { - $this->smarty->assign("nonadmins", $nonadmins); - } + if (isset($nonadmins)) { + $this->smarty->assign("nonadmins", $nonadmins); } } Added: trunk/modules/content_domain_new.php =================================================================== --- trunk/modules/content_domain_new.php (rev 0) +++ trunk/modules/content_domain_new.php 2007-07-13 13:23:57 UTC (rev 136) @@ -0,0 +1,124 @@ +<?php +/** + * @author Daniel Weuthen <da...@we...> + * @version $LastChangedRevision$ + * @package ELMA + * + * $Id$ + * $LastChangedBy$ + * + * ===================================================================== + * + * 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 Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * + * ===================================================================== + */ + +/** + * content domain new + * + * This content module is used for creatinga a new domain and + * handling the submited data. + */ + +class content_domain_new extends module_base +{ + + /** + * Constructor of this class + */ + function content_domain_new() + { + parent::module_base(); + } + + /** + * This method is called after the constructor by the main page + */ + function proceed() + { + $domain = $_GET["domain"]; + $this->smarty->assign("domain",$domain); + $this->smarty->assign("mailstorageservers",unserialize(MAILSTORAGESERVERS)); + + // new domain created or existing domain altert + if (isset($_POST["submit"])) { + // remove all non LDAP objects from submited form + // an the submit value + $my_domain = remove_key_by_str($_POST,"nlo_"); + + if (isset($_POST["admins"])) { + $admins = $my_domain["admins"]; + unset($my_domain["admins"]); + } + + if (isset($_POST["nonadmins"])) { + $nonadmins = $my_domain["nonadmins"]; + unset($my_domain["nonadmins"]); + } + + unset($my_domain["submit"]); + + if (isset($_POST["mailstatus"])) { + $my_domain["mailstatus"] = "TRUE"; + } else { + $my_domain["mailstatus"] = "FALSE"; + } + + $validation_errors = validate_domain($my_domain); + if (count($validation_errors) == 0) { + if (!isset($admins)) { + $admins = array(); + } + + $this->ldap->addDomain($my_domain, $admins); + + $submit_status = ldap_errno($this->ldap->cid); + if ($submit_status == "0") { + $this->smarty->assign("submit_status",$submit_status); + $domain = $my_domain["dc"]; + } else { + $this->smarty->assign("submit_status",ldap_err2str($submit_status)); + } + } else { + $this->smarty->assign("submit_status","Invalid Data"); + $this->smarty->assign("validation_errors",$validation_errors); + } + } else { + $this->smarty->assign("submit_status",-1); + } + + $this->smarty->assign("domain",array()); + + $systemusers = $this->ldap->listSystemUsers(); + unset($systemusers["count"]); + + $this->smarty->assign("nonadmins", $systemusers); + } + + /** + * This method returns any content that should be echoed by the + * main page. + * + * @return string + */ + function getContent() + { + $_content = $this->smarty->fetch('content_domain_new.tpl'); + return $_content; + } +} +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Modified: trunk/modules/content_domains_list.php =================================================================== --- trunk/modules/content_domains_list.php 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/modules/content_domains_list.php 2007-07-13 13:23:57 UTC (rev 136) @@ -64,7 +64,7 @@ $domain['aliasesactive'] = $this->ldap->aliasCount($domain['dc'], "TRUE"); array_push($my_domains,$domain); } - $this->smarty->assign("link_newdomain",$_SERVER['PHP_SELF']."?module=domain_edit&domain=new"); + $this->smarty->assign("link_newdomain",$_SERVER['PHP_SELF']."?module=domain_new"); $this->smarty->assign('domains',$my_domains); } Added: trunk/modules/content_user_new.php =================================================================== --- trunk/modules/content_user_new.php (rev 0) +++ trunk/modules/content_user_new.php 2007-07-13 13:23:57 UTC (rev 136) @@ -0,0 +1,104 @@ +<?php +/** + * @author Daniel Weuthen <da...@we...> + * @version $LastChangedRevision$ + * @package ELMA + * + * $Id$ + * $LastChangedBy$ + * + * ===================================================================== + * + * 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 Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * + * ===================================================================== + */ + +/** + * content user new + * + * This content module is used for creating the user add form and + * handling the submited data. + */ + +class content_user_new extends module_base +{ + + /** + * Constructor of this class + */ + function content_user_new() + { + parent::module_base(); + } + + /** + * This method is called after the constructor by the main page + */ + function proceed() + { + $user = $_GET["user"]; + $domain = $_GET["domain"]; + $this->smarty->assign("domain",$domain); + + // new user created or existing user modified + if (isset($_POST["submit"])) { + // remove all non LDAP objects from submited form + // an the submit value + $my_user = remove_key_by_str($_POST,"nlo_"); + unset($my_user["submit"]); + + if (isset($_POST["mailstatus"])) { + $my_user["mailstatus"] = "TRUE"; + } else { + $my_user["mailstatus"] = "FALSE"; + } + + $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); + + $validation_errors = validate_user($my_user); + if (count($validation_errors) == 0) { + $this->ldap->addUser($domain,$my_user); + + $submit_status = ldap_errno($this->ldap->cid); + if ($submit_status == "0") { + $this->smarty->assign("submit_status",$submit_status); + $user = $my_user["uid"]; + } else { + $this->smarty->assign("submit_status",ldap_err2str($submit_status)); + } + } else { + $this->smarty->assign("submit_status","Invalid Data"); + $this->smarty->assign("validation_errors",$validation_errors); + } + } else { + $this->smarty->assign("submit_status",-1); + } + } + + /** + * This method returns any content that should be echoed by the + * main page. + * + * @return string + */ + function getContent() + { + $_content = $this->smarty->fetch('content_user_new.tpl'); + return $_content; + } +} +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Modified: trunk/modules/content_users_list.php =================================================================== --- trunk/modules/content_users_list.php 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/modules/content_users_list.php 2007-07-13 13:23:57 UTC (rev 136) @@ -62,7 +62,7 @@ $user['editlink'] = $_SERVER['PHP_SELF']."?module=user_edit&domain=".$domain."&user=".$user['uid']; array_push($my_users,$user); } - $this->smarty->assign("link_newuser",$_SERVER['PHP_SELF']."?module=user_edit&domain=".$domain."&user=new"); + $this->smarty->assign("link_newuser",$_SERVER['PHP_SELF']."?module=user_new&domain=".$domain); $this->smarty->assign('users',$my_users); // prepare aliases array for smarty output @@ -76,7 +76,7 @@ $alias['editlink'] = $_SERVER['PHP_SELF']."?module=alias_edit&domain=".$domain."&alias=".$alias['uid']; array_push($my_aliases,$alias); } - $this->smarty->assign("link_newalias",$_SERVER['PHP_SELF']."?module=alias_edit&domain=".$domain."&alias=new"); + $this->smarty->assign("link_newalias",$_SERVER['PHP_SELF']."?module=alias_new&domain=".$domain); $this->smarty->assign('aliases',$my_aliases); } Modified: trunk/templates/simple/content_alias_edit.tpl =================================================================== --- trunk/templates/simple/content_alias_edit.tpl 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/templates/simple/content_alias_edit.tpl 2007-07-13 13:23:57 UTC (rev 136) @@ -1,18 +1,10 @@ <div id="Content"> - {if $mode == "modify"} <h2>{t}Edit alias{/t} {$alias.uid.0}@{$domain}</h2> - {else} - <h2>{t}New alias{/t}</h2> - {/if} {if $smarty.post.submit} {include file="print_submit_status.tpl"} {/if} <form action="{$smarty.server.php_self}" method="post"> - <div> - <input type="hidden" name="mode" value="{$mode}"/> - </div> <fieldset> - {if $mode == "modify"} <legend>{$alias.uid.0}@{$domain}</legend> <table> <tr> @@ -20,18 +12,6 @@ <input type="hidden" name="uid" value="{$alias.uid.0}" /> </td> </tr> - {else} - <legend>{t}new alias{/t}</legend> - <table> - <tr> - <td> - {t}Alias{/t} - </td> - <td> - <input type="text" name="uid" value="{$alias.uid.0}" />@{$domain} - </td> - </tr> - {/if} <tr> <td> {t}Alias for{/t} Added: trunk/templates/simple/content_alias_new.tpl =================================================================== --- trunk/templates/simple/content_alias_new.tpl (rev 0) +++ trunk/templates/simple/content_alias_new.tpl 2007-07-13 13:23:57 UTC (rev 136) @@ -0,0 +1,57 @@ + <div id="Content"> + <h2>{t}New alias{/t}</h2> + {if $smarty.post.submit} + {include file="print_submit_status.tpl"} + {/if} + <form action="{$smarty.server.php_self}" method="post"> + <fieldset> + <legend>{t}new alias{/t}</legend> + <table> + <tr> + <td> + {t}Alias{/t} + </td> + <td> + <input type="text" name="uid" value="{$alias.uid.0}" />@{$domain} + </td> + </tr> + <tr> + <td> + {t}Alias for{/t} + </td> + <td> + {strip} + <textarea name="nlo_mailaliasedname" cols="40" rows="10"> + {section name=mailaliasedname_sec loop=$alias.mailaliasedname} + {$alias.mailaliasedname[mailaliasedname_sec]} + {/section} + </textarea> + {/strip} + </td> + </tr> + <tr> + <td> + {t}Is active?{/t} + </td> + <td> + <input type="checkbox" name="mailstatus" {if $alias.mailstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + </td> + </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> + <td colspan="2" class="buttons"> + <input type="submit" name="submit" value="{t}Save{/t}"/> + </td> + </tr> + </table> + </fieldset> + </form> + </div> + +{* +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=smarty:syntax:ruler: +*} Modified: trunk/templates/simple/content_domains_list.tpl =================================================================== --- trunk/templates/simple/content_domains_list.tpl 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/templates/simple/content_domains_list.tpl 2007-07-13 13:23:57 UTC (rev 136) @@ -27,11 +27,12 @@ {/if} </td> <td class="command"> - <a href="{$domains[domains_sec].editlink}">{t}edit{/t}</a> - <a href="{$domains[domains_sec].deletelink}">{t}delete{/t}</a> + {if @in_array("domain_edit",$acl) }<a href="{$domains[domains_sec].editlink}">{t}edit{/t}</a>{/if} + {if @in_array("domain_delete",$acl) }<a href="{$domains[domains_sec].deletelink}">{t}delete{/t}</a>{/if} </td> </tr> {/section} + {if @in_array("domain_new",$acl) } <tr> <td class="last"> </td> <td class="last"> </td> @@ -41,6 +42,7 @@ <a href="{$link_newdomain}">{t}new domain{/t}</a> </td> </tr> + {/if} </table> </div> Modified: trunk/templates/simple/content_users_list.tpl =================================================================== --- trunk/templates/simple/content_users_list.tpl 2007-07-13 11:16:06 UTC (rev 135) +++ trunk/templates/simple/content_users_list.tpl 2007-07-13 13:23:57 UTC (rev 136) @@ -19,11 +19,12 @@ {/if} </td> <td class="command"> - <a href="{$users[users_sec].editlink}">{t}edit{/t}</a> - <a href="{$users[users_sec].deletelink}">{t}delete{/t}</a> + {if @in_array("user_edit",$acl)} <a href="{$users[users_sec].editlink}">{t}edit{/t}</a> {/if} + {if @in_array("user_delete",$acl)} <a href="{$users[users_sec].deletelink}">{t}delete{/t}</a>{/if} </td> </tr> {/section} + {if @in_array("user_new",$acl)} <tr> <td class="last"> </td> <td class="last"> </td> @@ -31,6 +32,7 @@ <a href="{$link_newuser}">{t}new user{/t}</a> </td> </tr> + {/if} </table> <div class="space25"></div> <table> @@ -60,11 +62,12 @@ {/if} </td> <td class="command"> - <a href="{$aliases[aliases_sec].editlink}">{t}edit{/t}</a> - <a href="{$aliases[aliases_sec].deletelink}">{t}delete{/t}</a> + {if @in_array("alias_edit",$acl)} <a href="{$aliases[aliases_sec].editlink}">{t}edit{/t}</a> {/if} + {if @in_array("alias_delete",$acl)} <a href="{$aliases[aliases_sec].deletelink}">{t}delete{/t}</a> {/if} </td> </tr> {/section} + {if @in_array("alias_new",$acl) } <tr> <td class="last"> </td> <td class="last"> </td> @@ -73,6 +76,7 @@ <a href="{$link_newalias}">{t}new alias{/t}</a> </td> </tr> + {/if} </table> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-13 11:16:15
|
Revision: 135 http://elma.svn.sourceforge.net/elma/?rev=135&view=rev Author: tuxevara Date: 2007-07-13 04:16:06 -0700 (Fri, 13 Jul 2007) Log Message: ----------- split domain/user edit and new modules/templates Modified Paths: -------------- trunk/templates/simple/content_domain_edit.tpl trunk/templates/simple/content_user_edit.tpl Added Paths: ----------- trunk/templates/simple/content_domain_new.tpl trunk/templates/simple/content_user_new.tpl Modified: trunk/templates/simple/content_domain_edit.tpl =================================================================== --- trunk/templates/simple/content_domain_edit.tpl 2007-07-12 14:53:10 UTC (rev 134) +++ trunk/templates/simple/content_domain_edit.tpl 2007-07-13 11:16:06 UTC (rev 135) @@ -1,36 +1,15 @@ <div id="Content"> - {if $mode == "modify"} <h2>{t }Edit domain{/t} {$domain.dc.0}</h2> - {else} - <h2>{t}New domain{/t}</h2> - {/if} {if $smarty.post.submit} {include file="print_submit_status.tpl"} {/if} <form action="{$smarty.server.php_self}" method="post" onsubmit="markAllAdmins()"> - <div> - <input type="hidden" name="mode" value="{$mode}" /> + <div> + <input type="hidden" name="dc" value="{$domain.dc.0}" /> </div> - {if $mode == "modify"} - <div> - <input type="hidden" name="dc" value="{$domain.dc.0}" /> - </div> - <fieldset> - <legend>{$domain.dc.0}</legend> - <table> - {else} - <fieldset> - <legend>{t}new domain{/t}</legend> - <table> - <tr> - <td> - {t}Domain{/t} - </td> - <td> - <input type="text" name="dc" /> - </td> - </tr> - {/if} + <fieldset> + <legend>{$domain.dc.0}</legend> + <table> <tr> <td> {t}Is active?{/t} Added: trunk/templates/simple/content_domain_new.tpl =================================================================== --- trunk/templates/simple/content_domain_new.tpl (rev 0) +++ trunk/templates/simple/content_domain_new.tpl 2007-07-13 11:16:06 UTC (rev 135) @@ -0,0 +1,121 @@ + <div id="Content"> + <h2>{t}New domain{/t}</h2> + {if $smarty.post.submit} + {include file="print_submit_status.tpl"} + {/if} + <form action="{$smarty.server.php_self}" method="post" onsubmit="markAllAdmins()"> + <fieldset> + <legend>{t}new domain{/t}</legend> + <table> + <tr> + <td> + {t}Domain{/t} + </td> + <td> + <input type="text" name="dc" /> + </td> + </tr> + <tr> + <td> + {t}Is active?{/t} + </td> + <td> + <input type="checkbox" name="mailstatus" {if $domain.mailstatus.0 eq "TRUE"}checked="checked"{/if} /> + </td> + </tr> + {if @in_array("domain_new.mailstorageserver",$acl) } + <tr> + <td> + {t}Mailstorageserver{/t} + </td> + <td> + <select name="mailstorageserver"> + {foreach from=$mailstorageservers item=server} + <option {if $domain.mailstorageserver.0 eq $server}selected{/if}>{$server}</option> + {/foreach} + </select> + </td> + </tr> + {/if} + <tr> + <td colspan="2"> + <hr /> + </td> + </tr> + <tr> + <td> + ACL + </td> + <td> + <table> + <tr> + <td> + {t}Administrators{/t} + <br /> + <select name="admins[]" size="8" multiple="multiple"> + <optgroup label="{t}Systemusers{/t}"> + {foreach from=$admins item=admin} + {if ! @in_array("mailUser",$admin.objectclass) } + <option value="{$admin.dn}">{$admin.uid[0]} ({$admin.cn[0]} {$admin.sn[0]})</option> + {/if} + {/foreach} + </optgroup> + <optgroup label="{t}Domainsusers{/t}"> + {foreach from=$admins item=admin} + {if @in_array("mailUser",$admin.objectclass) } + <option value="{$admin.dn}">{$admin.uid[0]} ({$admin.cn[0]} {$admin.sn[0]})</option> + {/if} + {/foreach} + </optgroup> + </select> + </td> + <td> + <div> + <br /> + <br /> + <input type="button" name="delfromlist" value=">" onclick="delAdmin()" /> + <br /> + <br /> + <input type="button" name="addtolist" value="<" onclick="addAdmin()" /> + </div> + </td> + <td> + {t}available users{/t} + <br /> + <select name="nonadmins[]" size="8" multiple="multiple"> + <optgroup label="{t}Systemusers{/t}"> + {foreach from=$nonadmins item=nonadmin} + {if ! @in_array("mailUser",$nonadmin.objectclass) } + <option value="{$nonadmin.dn}">{$nonadmin.uid[0]} ({$nonadmin.cn[0]} {$nonadmin.sn[0]})</option> + {/if} + {/foreach} + </optgroup> + <optgroup label="{t}Domainusers{/t}"> + {foreach from=$nonadmins item=nonadmin} + {if @in_array("mailUser",$nonadmin.objectclass) } + <option value="{$nonadmin.dn}">{$nonadmin.uid[0]} ({$nonadmin.cn[0]} {$nonadmin.sn[0]})</option> + {/if} + {/foreach} + </optgroup> + </select> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td colspan="2"> + <hr /> + </td> + </tr> + <tr> + <td colspan="2" class="buttons"><input type="submit" name="submit" value="{t}Save{/t}" /></td> + </tr> + </table> + </fieldset> + </form> + </div> + +{* +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=smarty:syntax:ruler: +*} Modified: trunk/templates/simple/content_user_edit.tpl =================================================================== --- trunk/templates/simple/content_user_edit.tpl 2007-07-12 14:53:10 UTC (rev 134) +++ trunk/templates/simple/content_user_edit.tpl 2007-07-13 11:16:06 UTC (rev 135) @@ -1,18 +1,10 @@ <div id="Content"> - {if $mode == "modify"} <h2>{t}Edit user{/t} {$user.uid.0}@{$domain}</h2> - {else} - <h2>{t}New user{/t}</h2> - {/if} {if $smarty.post.submit} {include file="print_submit_status.tpl"} {/if} <form action="{$smarty.server.php_self}" method="post"> - <div> - <input type="hidden" name="mode" value="{$mode}"/> - </div> <fieldset> - {if $mode == "modify"} <legend>{$user.uid.0}@{$domain}</legend> <table> <tr> @@ -20,18 +12,6 @@ <input type="hidden" name="uid" value="{$user.uid.0}" /> </td> </tr> - {else} - <legend>{t}new user{/t}</legend> - <table> - <tr> - <td> - {t}Username{/t} - </td> - <td> - <input type="text" name="uid" value="{$user.uid.0}" />@{$domain} - </td> - </tr> - {/if} <tr> <td> {t}First name{/t} Added: trunk/templates/simple/content_user_new.tpl =================================================================== --- trunk/templates/simple/content_user_new.tpl (rev 0) +++ trunk/templates/simple/content_user_new.tpl 2007-07-13 11:16:06 UTC (rev 135) @@ -0,0 +1,72 @@ + <div id="Content"> + <h2>{t}New user{/t}</h2> + {if $smarty.post.submit} + {include file="print_submit_status.tpl"} + {/if} + <form action="{$smarty.server.php_self}" method="post"> + <fieldset> + <legend>{t}new user{/t}</legend> + <table> + <tr> + <td> + {t}Username{/t} + </td> + <td> + <input type="text" name="uid" value="{$user.uid.0}" />@{$domain} + </td> + </tr> + <tr> + <td> + {t}First name{/t} + </td> + <td> + <input type="text" name="cn" value="{$user.cn.0}" /> + </td> + </tr> + <tr> + <td> + {t}Last name{/t} + </td> + <td> + <input type="text" name="sn" value="{$user.sn.0}" /> + </td> + </tr> + <tr> + <td> + {t}Is active?{/t} + </td> + <td> + <input type="checkbox" name="mailstatus" {if $user.mailstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + </td> + </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> + <td> + {t}Password{/t} + </td> + <td> + <input type="text" name="clearpassword" value="{$user.clearpassword.0}" /> + </td> + </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> + <td colspan="2" class="buttons"> + <input type="submit" name="submit" value="{t}Save{/t}" id="button"/> + </td> + </tr> + </table> + </fieldset> + </form> + </div> + +{* +// vim:tabstop=4:expandtab:shiftwidth=4:filetype=smarty:syntax:ruler: +*} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 14:53:13
|
Revision: 134 http://elma.svn.sourceforge.net/elma/?rev=134&view=rev Author: tuxevara Date: 2007-07-12 07:53:10 -0700 (Thu, 12 Jul 2007) Log Message: ----------- fixed statistic problem: inactive user were count as if active Modified Paths: -------------- trunk/includes/ldap_functions.inc.php Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-12 13:12:42 UTC (rev 133) +++ trunk/includes/ldap_functions.inc.php 2007-07-12 14:53:10 UTC (rev 134) @@ -239,8 +239,8 @@ * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only * @attribute array ldap attributes to return, empty array returns everything */ - function getUser ( $domain_dc, $user_uid = "*", $active="*", $attribute = array() ) { - $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))", $attribute); + function getUser ( $domain_dc, $user_uid="*", $active="*", $attribute = array() ) { + $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(mailStatus=$active)(uid=$user_uid))", $attribute); $user = ldap_get_entries($this->cid, $result); if ( $user_uid !== "*" ) $user = $user[0]; return $user; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 13:12:43
|
Revision: 133 http://elma.svn.sourceforge.net/elma/?rev=133&view=rev Author: tuxevara Date: 2007-07-12 06:12:42 -0700 (Thu, 12 Jul 2007) Log Message: ----------- some corrections Modified Paths: -------------- trunk/doc/INSTALL trunk/doc/INSTALL.html Modified: trunk/doc/INSTALL =================================================================== --- trunk/doc/INSTALL 2007-07-12 13:05:10 UTC (rev 132) +++ trunk/doc/INSTALL 2007-07-12 13:12:42 UTC (rev 133) @@ -67,7 +67,7 @@ # chown www-data:www-data /var/www/templates_c/ # chmod 775 /var/www/templates_c/ -Now you should be able to log in to ELAM via a webbrowser using the user "admin" with password +Now you should be able to log in to ELMA via a webbrowser using the user "admin" with password "adminpass". To change the admin's user password you have to use the ldap tools of you distribution or use something similar to "phpLdapAdmin" or "gq". Modified: trunk/doc/INSTALL.html =================================================================== --- trunk/doc/INSTALL.html 2007-07-12 13:05:10 UTC (rev 132) +++ trunk/doc/INSTALL.html 2007-07-12 13:12:42 UTC (rev 133) @@ -74,10 +74,9 @@ # chown www-data:www-data /var/www/templates_c/ # chmod 775 /var/www/templates_c/ -<P>Now you should be able to log in to ELAM via a webbrowser using the user "admin" with password +<P>Now you should be able to log in to ELMA via a webbrowser using the user "admin" with password "adminpass". To change the admin's user password you have to use the ldap tools of you distribution or use something similar to "phpLdapAdmin" or "gq". -<P>vim:tabstop=4:expandtab:shiftwidth=4:syntax:ruler: </BODY> </HTML> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 13:05:12
|
Revision: 132 http://elma.svn.sourceforge.net/elma/?rev=132&view=rev Author: tuxevara Date: 2007-07-12 06:05:10 -0700 (Thu, 12 Jul 2007) Log Message: ----------- updated INSTALL.html file Modified Paths: -------------- trunk/doc/INSTALL.html Modified: trunk/doc/INSTALL.html =================================================================== --- trunk/doc/INSTALL.html 2007-07-12 13:04:00 UTC (rev 131) +++ trunk/doc/INSTALL.html 2007-07-12 13:05:10 UTC (rev 132) @@ -5,7 +5,7 @@ <META NAME="generator" CONTENT="HTML::TextToHTML v2.44"> </HEAD> <BODY> -<P>########## ELMA 0.1 Quick Installation Guide ########## +<P>########## ELMA 0.2 Quick Installation Guide ########## <P>Content of this document @@ -27,7 +27,7 @@ <UL> <LI>Apache 2.2.3 - <LI>5.2.0, PHP 4.4.4 should also work + <LI>PHP 5.2.0, PHP 4.4.4 should also work <LI>OpenLDAP 2.3.30 <LI>Smarty 2.6.14 <LI>Smarty-Gettext 1.0b1 @@ -40,8 +40,12 @@ <P>Install and set up your ldap server as described in your distriubution's manual. There is an example openldap slapd.conf in the ldap subdirectory of the doc folder. -To start with an empty LDAP tree, clear your LDAP tree (refer to distriubution's manual) and run +First copy the elma-0.2.schema file into you LDAP server schema folder +<P> # cp examples/ldap/elma-0.2.schema /etc/ldap/schema/ + +<P>To start with an empty LDAP tree, clear your LDAP tree (refer to distriubution's manual) and run + <P> # slapadd -l examples/ldap/example.ldif <P>from within the directory where this INSTALL file is located. This will create an admin user @@ -74,5 +78,6 @@ "adminpass". To change the admin's user password you have to use the ldap tools of you distribution or use something similar to "phpLdapAdmin" or "gq". +<P>vim:tabstop=4:expandtab:shiftwidth=4:syntax:ruler: </BODY> </HTML> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 13:04:02
|
Revision: 131 http://elma.svn.sourceforge.net/elma/?rev=131&view=rev Author: tuxevara Date: 2007-07-12 06:04:00 -0700 (Thu, 12 Jul 2007) Log Message: ----------- updated version number and information about elma-0.2.schema Modified Paths: -------------- trunk/doc/INSTALL Modified: trunk/doc/INSTALL =================================================================== --- trunk/doc/INSTALL 2007-07-12 12:56:26 UTC (rev 130) +++ trunk/doc/INSTALL 2007-07-12 13:04:00 UTC (rev 131) @@ -1,4 +1,4 @@ -########## ELMA 0.1 Quick Installation Guide ########## +########## ELMA 0.2 Quick Installation Guide ########## Content of this document @@ -19,7 +19,7 @@ 1.1.1 Debian Etch * Apache 2.2.3 - * 5.2.0, PHP 4.4.4 should also work + * PHP 5.2.0, PHP 4.4.4 should also work * OpenLDAP 2.3.30 * Smarty 2.6.14 * Smarty-Gettext 1.0b1 @@ -33,6 +33,10 @@ Install and set up your ldap server as described in your distriubution's manual. There is an example openldap slapd.conf in the ldap subdirectory of the doc folder. +First copy the elma-0.2.schema file into you LDAP server schema folder + + # cp examples/ldap/elma-0.2.schema /etc/ldap/schema/ + To start with an empty LDAP tree, clear your LDAP tree (refer to distriubution's manual) and run # slapadd -l examples/ldap/example.ldif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 12:56:27
|
Revision: 130 http://elma.svn.sourceforge.net/elma/?rev=130&view=rev Author: tuxevara Date: 2007-07-12 05:56:26 -0700 (Thu, 12 Jul 2007) Log Message: ----------- html version of install file added Added Paths: ----------- trunk/doc/INSTALL.html Added: trunk/doc/INSTALL.html =================================================================== --- trunk/doc/INSTALL.html (rev 0) +++ trunk/doc/INSTALL.html 2007-07-12 12:56:26 UTC (rev 130) @@ -0,0 +1,78 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<HTML> +<HEAD> +<TITLE></TITLE> +<META NAME="generator" CONTENT="HTML::TextToHTML v2.44"> +</HEAD> +<BODY> +<P>########## ELMA 0.1 Quick Installation Guide ########## + +<P>Content of this document + +<P><STRONG>1.1 REQUIREMENTS</STRONG> +<P> 1.1.1 Debian Etch<BR> +<STRONG>1.2 PREPARATIONS</STRONG> +<P> 1.2.1 LDAP Server<BR> +<STRONG>1.3 INSTALLATION</STRONG> + +<P><STRONG>-----------------------------------------------------</STRONG> + +<P><STRONG>1.1 REQUIREMENTS</STRONG> + +<P>The requirements are based on the current Debian GNU/Linux stable branch also known as "Etch". +ELMA has been developed and test on that distribution. If you have successfully installed and +run it on any other distributions plaese send a short mail and this list will be completed. + +<P>1.1.1 Debian Etch + +<UL> + <LI>Apache 2.2.3 + <LI>5.2.0, PHP 4.4.4 should also work + <LI>OpenLDAP 2.3.30 + <LI>Smarty 2.6.14 + <LI>Smarty-Gettext 1.0b1 +</UL> +<P><STRONG>1.2 PREPARATIONS</STRONG> + +<P>1.2.1 LDAP Server + +<P>ELMA has been testet only to work with OpenLDAP Server. + +<P>Install and set up your ldap server as described in your distriubution's manual. +There is an example openldap slapd.conf in the ldap subdirectory of the doc folder. +To start with an empty LDAP tree, clear your LDAP tree (refer to distriubution's manual) and run + +<P> # slapadd -l examples/ldap/example.ldif + +<P>from within the directory where this INSTALL file is located. This will create an admin user +with the dn "uid=admin,ou=users,o=mybasedn" and the password "adminpass". Also an exim user +("uid=exim4,ou=users,o=mybasedn") with read only access to the LDAP will be created. The password +is "exim4pass". I think it is obvious to tell you that you should change the passwords for your +installation. <BR> +IMPORTANT NOTE: The above step creates the database files who's owner is "root". If you run +your LDAP server under an other uid/gid, as you should if you care about security concerns, you +will have to change the ownership of the LDAP database files corrosponding to the LDAP servers uid/gid. + +<P><STRONG>1.3 INSTALLATION</STRONG> + +<P>Copy the downloaded tarball to your webserver's document root directory (e.g. /var/www). + +<P> # cp elma-0.2.tar.gz /var/www + +<P>Extract the tarball in your webserver's document root directory. + +<P> # tar -xzvf elma-0.2.tar.gz + +<P>Create the smart's template cache directory called "template_c" and make it writable for you +webserver's user (e.g www-data) + +<P> # mkdir /var/www/templates_c/<BR> + # chown www-data:www-data /var/www/templates_c/ + # chmod 775 /var/www/templates_c/ + +<P>Now you should be able to log in to ELAM via a webbrowser using the user "admin" with password +"adminpass". To change the admin's user password you have to use the ldap tools of you distribution +or use something similar to "phpLdapAdmin" or "gq". + +</BODY> +</HTML> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-12 12:33:29
|
Revision: 129 http://elma.svn.sourceforge.net/elma/?rev=129&view=rev Author: tuxevara Date: 2007-07-12 05:33:26 -0700 (Thu, 12 Jul 2007) Log Message: ----------- updated docs and examples new elma-0.2 schema added Modified Paths: -------------- trunk/VERSION trunk/changelog trunk/doc/INSTALL trunk/doc/README.templates trunk/doc/examples/ldap/example.ldif trunk/doc/examples/ldap/slapd.conf Added Paths: ----------- trunk/doc/examples/ldap/elma-0.2.schema Removed Paths: ------------- trunk/doc/examples/ldap/elma-0.1.schema Modified: trunk/VERSION =================================================================== --- trunk/VERSION 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/VERSION 2007-07-12 12:33:26 UTC (rev 129) @@ -1 +1 @@ -0.1 +0.2 Modified: trunk/changelog =================================================================== --- trunk/changelog 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/changelog 2007-07-12 12:33:26 UTC (rev 129) @@ -1,3 +1,9 @@ +2007-07-12 Daniel Weuthen <da...@we...> + * Feature added: multiple systemusers + * Feature added: multiple administrators per domain selectable from + systemusers and domainsusers + * Feature added: simple usage statistics on welcome page + 2007-05-24 Daniel Weuthen <da...@we...> * Bugfix 1712754: missing documentation * Bugfix 1712706: Ldap config not complete Modified: trunk/doc/INSTALL =================================================================== --- trunk/doc/INSTALL 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/doc/INSTALL 2007-07-12 12:33:26 UTC (rev 129) @@ -1,7 +1,17 @@ ########## ELMA 0.1 Quick Installation Guide ########## +Content of this document + 1.1 REQUIREMENTS + 1.1.1 Debian Etch +1.2 PREPARATIONS + 1.2.1 LDAP Server +1.3 INSTALLATION +#-----------------------------------------------------# + +1.1 REQUIREMENTS + The requirements are based on the current Debian GNU/Linux stable branch also known as "Etch". ELMA has been developed and test on that distribution. If you have successfully installed and run it on any other distributions plaese send a short mail and this list will be completed. @@ -9,7 +19,7 @@ 1.1.1 Debian Etch * Apache 2.2.3 - * PHP 4.4.4 + * 5.2.0, PHP 4.4.4 should also work * OpenLDAP 2.3.30 * Smarty 2.6.14 * Smarty-Gettext 1.0b1 @@ -22,26 +32,29 @@ ELMA has been testet only to work with OpenLDAP Server. Install and set up your ldap server as described in your distriubution's manual. -There is an example openldap slapd.conf in the ldap subdirectory. -Start with an empty LDAP tree and run +There is an example openldap slapd.conf in the ldap subdirectory of the doc folder. +To start with an empty LDAP tree, clear your LDAP tree (refer to distriubution's manual) and run # slapadd -l examples/ldap/example.ldif from within the directory where this INSTALL file is located. This will create an admin user -with the dn "uid=admin,ou=users,o=mybasedn" and the password "adminpass". Also a exim user -("uid=exim4,ou=users,o=mybasedn") with read only access to the tree will be created. The password -is "exim4pass". I think it is obvious to tell you that you should change the passwords of your -installation. +with the dn "uid=admin,ou=users,o=mybasedn" and the password "adminpass". Also an exim user +("uid=exim4,ou=users,o=mybasedn") with read only access to the LDAP will be created. The password +is "exim4pass". I think it is obvious to tell you that you should change the passwords for your +installation. +IMPORTANT NOTE: The above step creates the database files who's owner is "root". If you run +your LDAP server under an other uid/gid, as you should if you care about security concerns, you +will have to change the ownership of the LDAP database files corrosponding to the LDAP servers uid/gid. -1.2 INSTALLATION +1.3 INSTALLATION Copy the downloaded tarball to your webserver's document root directory (e.g. /var/www). - # cp elma-0.1.tar.gz /var/www + # cp elma-0.2.tar.gz /var/www Extract the tarball in your webserver's document root directory. - # tar -xzvf elma-0.1.tar.gz + # tar -xzvf elma-0.2.tar.gz Create the smart's template cache directory called "template_c" and make it writable for you webserver's user (e.g www-data) @@ -52,4 +65,6 @@ Now you should be able to log in to ELAM via a webbrowser using the user "admin" with password "adminpass". To change the admin's user password you have to use the ldap tools of you distribution -or use something similar like "phpLdapAdmin" or "gq". +or use something similar to "phpLdapAdmin" or "gq". + +vim:tabstop=4:expandtab:shiftwidth=4:syntax:ruler: Modified: trunk/doc/README.templates =================================================================== --- trunk/doc/README.templates 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/doc/README.templates 2007-07-12 12:33:26 UTC (rev 129) @@ -10,4 +10,4 @@ footer.tpl : </body> and </html> tag should only be used here, maybe some generic page footer too. -vim:textwidth=78: +vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Deleted: trunk/doc/examples/ldap/elma-0.1.schema =================================================================== --- trunk/doc/examples/ldap/elma-0.1.schema 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/doc/examples/ldap/elma-0.1.schema 2007-07-12 12:33:26 UTC (rev 129) @@ -1,38 +0,0 @@ -# common Attributes -attributetype ( 1.3.6.1.4.1.25287.1.1.2.1 - NAME 'mailStatus' - DESC 'Enable/Disable domain, user or alias.' - EQUALITY booleanMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 - SINGLE-VALUE ) - -# mailDomain -objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 - NAME 'mailDomain' SUP domain - DESC 'Mail Domain' STRUCTURAL - MUST ( dc ) - MAY ( mailStatus ) ) - -# mailUser -attributetype ( 1.3.6.1.4.1.25287.1.1.2.201 - NAME 'clearpassword' - DESC 'Clear CRAM-MD5 Password' SUP name - EQUALITY caseExactMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) - -objectclass ( 1.3.6.1.4.1.25287.1.1.1.200 - NAME 'mailUser' - DESC 'Mail router user' SUP person STRUCTURAL - MUST ( uid $ userPassword ) - MAY ( mailStatus $ clearpassword) ) - -# mailAlias -attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' - DESC 'Mail router aliased name' SUP name ) - -objectclass ( 1.3.6.1.4.1.25287.1.1.2.300 NAME 'mailAlias' - DESC 'Mail alias' SUP top STRUCTURAL - MUST ( uid $ mailAliasedName ) - MAY ( mailStatus) ) - - Added: trunk/doc/examples/ldap/elma-0.2.schema =================================================================== --- trunk/doc/examples/ldap/elma-0.2.schema (rev 0) +++ trunk/doc/examples/ldap/elma-0.2.schema 2007-07-12 12:33:26 UTC (rev 129) @@ -0,0 +1,44 @@ +# common Attributes +attributetype ( 1.3.6.1.4.1.25287.1.1.2.1 + NAME 'mailStatus' + DESC 'Enable/Disable domain, user or alias.' + EQUALITY booleanMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 + SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.25287.1.1.2.2 + NAME ( 'mailStorageserver' ) + DESC 'fqhn of mailstorage host' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) + +# mailDomain +objectclass ( 1.3.6.1.4.1.25287.1.1.2.100 + NAME 'mailDomain' SUP domain + DESC 'Mail Domain' STRUCTURAL + MUST ( dc $ mailStatus $ mailStorageserver) ) + +# mailUser +attributetype ( 1.3.6.1.4.1.25287.1.1.2.201 + NAME 'clearpassword' + DESC 'cleartext password, e.g. for CRAM-MD5' SUP name + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE) + +objectclass ( 1.3.6.1.4.1.25287.1.1.1.200 + NAME 'mailUser' + DESC 'Mail router user' SUP person STRUCTURAL + MUST ( uid $ userPassword $ homeDirectory $ mailStatus $ mailStorageserver) + MAY ( clearpassword) ) + +# mailAlias +attributetype ( 1.3.6.1.4.1.25287.1.1.2.301 NAME 'mailAliasedName' + DESC 'Mail router aliased name' SUP name ) + +objectclass ( 1.3.6.1.4.1.25287.1.1.2.300 NAME 'mailAlias' + DESC 'Mail alias' SUP top STRUCTURAL + MUST ( uid $ mailAliasedName ) + MAY ( mailStatus) ) + + Modified: trunk/doc/examples/ldap/example.ldif =================================================================== --- trunk/doc/examples/ldap/example.ldif 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/doc/examples/ldap/example.ldif 2007-07-12 12:33:26 UTC (rev 129) @@ -1,33 +1,28 @@ dn: o=mybasedn -objectClass: top objectClass: organization o: mybasedn -structuralObjectClass: organization +dn: ou=domains,o=mybasedn +ou: domains +objectClass: organizationalUnit + dn: ou=users,o=mybasedn -objectClass: top objectClass: organizationalUnit ou: users -structuralObjectClass: organizationalUnit +dn: cn=admingroup,ou=users,o=mybasedn +cn: admingroup +objectClass: groupOfNames +member: uid=admin,ou=users,o=mybasedn + dn: uid=admin,ou=users,o=mybasedn uid: admin -userPassword:: e01ENX1KZVR1VHBJcE9YdHJGM2RyL09yNDV3PT0= +userPassword: {MD5}JeTuTpIpOXtrF3dr/Or45w== objectClass: account objectClass: simpleSecurityObject -objectClass: top -structuralObjectClass: account dn: uid=exim4,ou=users,o=mybasedn uid: exim4 -userPassword:: e01ENX1iNFJMbXJZL3NxUGpURmN3V2g3c1FnPT0= objectClass: account objectClass: simpleSecurityObject -objectClass: top -structuralObjectClass: account - -dn: ou=domains,o=mybasedn -ou: domains -objectClass: top -objectClass: organizationalUnit -structuralObjectClass: organizationalUnit +userPassword: {MD5}b4RLmrY/sqPjTFcwWh7sQg== Modified: trunk/doc/examples/ldap/slapd.conf =================================================================== --- trunk/doc/examples/ldap/slapd.conf 2007-07-11 21:58:04 UTC (rev 128) +++ trunk/doc/examples/ldap/slapd.conf 2007-07-12 12:33:26 UTC (rev 129) @@ -12,7 +12,7 @@ include /etc/ldap/schema/cosine.schema include /etc/ldap/schema/nis.schema include /etc/ldap/schema/inetorgperson.schema -include /etc/ldap/schema/elma-0.1.schema +include /etc/ldap/schema/elma-0.2.schema # Where the pid file is put. The init.d script # will not stop the server if you change this. @@ -60,34 +60,31 @@ by group="cn=admingroup,ou=users,o=mybasedn" write by dn="uid=exim4,ou=users,o=mybasedn" read by group.regex="cn=admingroup,dc=$1,ou=domains,o=mybasedn" write - by anonymout auth + by anonymous auth by self write by * none -# The userPassword by default can be changed -# by the entry owning it if they are authenticated. -# Others should not be able to see it, except the -# admin entry below -# These access lines apply to database #1 only -access to attrs=userPassword,shadowLastChange +# The userPassword and clearpassword by default can be changed +# by the entry owning it if they are authenticated and global or +# domainadmins. +access to attrs=userPassword,clearpassword by dn="uid=admin,ou=users,o=mybasedn" write by group="cn=admingroup,ou=users,o=mybasedn" write by dn="uid=exim4,ou=users,o=mybasedn" read + by group.regex="cn=admingroup,dc=$1,ou=domains,o=mybasedn" write by anonymous auth by self write by * none -# +# access to systemadmins is only allowed for the admin. access to dn.regex="^uid=.*,ou=users,o=mybasedn$" by dn="uid=admin,ou=users,o=mybasedn" write - by group="cn=admingroup,ou=users,o=mybasedn" write by dn="uid=exim4,ou=users,o=mybasedn" read - by users read + by anonymous auth by self write by * none -# The admin dn has full write access, everyone else -# can read everything. +# The admin dn has full write access. # Users may Change their own Details. access to * by dn="uid=admin,ou=users,o=mybasedn" write This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-11 21:58:06
|
Revision: 128 http://elma.svn.sourceforge.net/elma/?rev=128&view=rev Author: tuxevara Date: 2007-07-11 14:58:04 -0700 (Wed, 11 Jul 2007) Log Message: ----------- some more variable renaming. everything should be self explaining now Modified Paths: -------------- trunk/includes/ldap_functions.inc.php Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-11 16:05:34 UTC (rev 127) +++ trunk/includes/ldap_functions.inc.php 2007-07-11 21:58:04 UTC (rev 128) @@ -106,8 +106,8 @@ * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only * @attribute array array of ldap attributes to return, empty array returns everything */ - function listDomains ($active="*", $attribute=array() ) { - $domains = $this->getDomain("*", $active="*", $attribute=array()); + function listDomains ($active="*", $attributes=array() ) { + $domains = $this->getDomain("*", $active="*", $attributes=array()); return $domains; } @@ -120,8 +120,8 @@ * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only * @attribute array ldap attributes to return, empty array returns everything */ - function getDomain ( $domain_dc="*", $active="*", $attribute=array() ) { - $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(objectClass=mailDomain)(dc=$domain_dc)(mailStatus=$active))", $attribute); + function getDomain ( $domain_dc="*", $active="*", $attributes=array() ) { + $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(objectClass=mailDomain)(dc=$domain_dc)(mailStatus=$active))", $attributes); $domain = ldap_get_entries($this->cid, $result); if (isset($domain[0])) { @@ -350,8 +350,8 @@ * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only * @attribute array ldap attributes to return, empty array returns everything */ - function listAliases( $domain_dc, $active="*", $attribute=array() ) { - $aliases = $this->getAlias( $domain_dc, "*", $active="*", $attribute=array()); + function listAliases( $domain_dc, $active="*", $attributes=array() ) { + $aliases = $this->getAlias( $domain_dc, "*", $active="*", $attributes=array()); return $aliases; } @@ -363,10 +363,10 @@ * @domain_dc string dc= value of the domain the alias is in * @alias_uid string uid= value if the alias, "*" returns all aliases for the given domain * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only - * @attribute array ldap attributes to return, empty array returns everything + * @attributes array ldap attributes to return, empty array returns everything */ - function getAlias ( $domain_dc, $alias_uid = "*", $active="*", $attribute=array() ) { - $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid)(mailStatus=$active))", $attribute); + function getAlias ( $domain_dc, $alias_uid="*", $active="*", $attributes=array() ) { + $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid)(mailStatus=$active))", $attributes); $alias = ldap_get_entries($this->cid, $result); if ( $alias_uid !== "*" ) $alias = $alias[0]; return $alias; @@ -382,7 +382,7 @@ */ function addAlias ( $domain_dc, $alias) { $alias["objectclass"] = "mailAlias"; - ldap_add($this->cid, "uid=".$alias['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $alias);a + ldap_add($this->cid, "uid=".$alias['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $alias); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -563,16 +563,16 @@ # ADMINGROUP /** - * listAdminUsers - lists users from the given domain's admin group + * listAdminUsers - lists users from the give admingroup * - * This function lists all users listed in a domain's admingroup. + * This function lists all users from the global or a domain's admingroup. * - * @domain string dc= value of a domain - * @dn_only boolean should only the dn be returned + * @domain_dc string dc= value of a domain + * @dn_only boolean should only the dn be returned */ - function listAdminUsers ($domain=null, $dn_only = "FALSE") { - if ( $domain != null ) { - $result = ldap_read($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN,"member=*"); + function listAdminUsers ($domain_dc=null, $dn_only = "FALSE") { + if ( $domain_dc != null ) { + $result = ldap_read($this->cid, "cn=admingroup,dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN,"member=*"); } else { $result = ldap_read($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN,"member=*"); } @@ -607,14 +607,14 @@ * * when domain is not set the global admingroup will be used instead * - * @domain string dc= value of a domain's dn - * @users array dn's of one or more users + * @domain_dc string dc= value of a domain's dn + * @newadmins array dn's of one or more users */ - function addAdminUsers ($domain=null, $newadmins=array()) { + function addAdminUsers ($domain_dc=null, $newadmins=array()) { $admingroup["member"] = $newadmins; - if ($domain != null) { - ldap_mod_add($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $admingroup); + if ($domain_dc != null) { + ldap_mod_add($this->cid, "cn=admingroup,dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $admingroup); } else { ldap_mod_add($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN, $admingroup); } @@ -634,15 +634,14 @@ * * when domain is not set the global admingroup will be used instead * - * @domain string dc= value of a domain's dn - * @users array dn's of one or more users + * @domain_dc string dc= value of a domain's dn + * @users array dn's of one or more users */ - function deleteAdminUsers ($domain=null, $users) { - + function deleteAdminUsers ($domain_dc=null, $users) { if ( count($users) > 0 ) { $admins["member"] = $users; - if ($domain != null) { - ldap_mod_del($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $admins); + if ($domain_dc != null) { + ldap_mod_del($this->cid, "cn=admingroup,dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $admins); } else { ldap_mod_del($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN, $admins); } @@ -666,27 +665,22 @@ * when domain is set to null users will be counted globally * when active is set to "TRUE" only active users will be listed * - * @domain string dc= value of a domain's dn - * @active string * for global search, "TRUE" for actives only + * @domain_dc string dc= value of a domain's dn + * @active string * for global search, "TRUE" for actives only */ - function userCount ($domain=null, $active="*") { - if ($domain != null) { - $result = $this->getUser($domain, "*", $active); - $tmpcount = $result["count"]; + function userCount ($domain_dc=null, $active="*") { + $nrofusers = 0; + if ($domain_dc != null) { + $users = $this->getUser($domain_dc, "*", $active); + $nrofusers = $users["count"]; } else { - $result = $this->listDomains(); - - $count = $result["count"]; - $tmpcount = 0; - - for ($i=0; $i<$count; $i++) { - $tmpresult = $this->getUser($result[$i]["dc"][0], "*", $active); - - $tmpcount += $tmpresult["count"]; + $domains = $this->listDomains(); + for ($i=0; $i<$domains["count"]; $i++) { + $users = $this->getUser($domains[$i]["dc"][0], "*", $active); + $nrofusers += $users["count"]; } } - - return $tmpcount; + return $nrofusers; } /** @@ -697,27 +691,23 @@ * when domain is set to null users will be counted globally * when active is set to "TRUE" only active users will be listed * - * @domain string dc= value of a domain's dn - * @active string * for global search, "TRUE" for actives only + * @domain_dc string dc= value of a domain's dn + * @active string * for global search, "TRUE" for actives only */ - function aliasCount ($domain=null, $active="*") { - if ($domain != null) { - $result = $this->getAlias($domain, "*", $active); - $tmpcount = $result["count"]; + function aliasCount ($domain_dc=null, $active="*") { + $nrofaliases = 0; + if ($domain_dc != null) { + $aliases= $this->getAlias($domain_dc, "*", $active); + $nrofaliases = $aliases["count"]; } else { - $result = $this->listDomains(); - - $count = $result["count"]; - $tmpcount = 0; - - for ($i=0; $i<$count; $i++) { - $tmpresult = $this->getAlias($result[$i]["dc"][0], "*", $active); - - $tmpcount += $tmpresult["count"]; + $domains = $this->listDomains(); + for ($i=0; $i<$domains["count"]; $i++) { + $aliases = $this->getAlias($domains[$i]["dc"][0], "*", $active); + $nrofaliases += $aliases["count"]; } } - return $tmpcount; + return $nrofaliases; } /** @@ -730,10 +720,10 @@ * @active string * for global search, "TRUE" for actives only */ function domainCount ($active="*") { - $result = $this->getDomain("*", $active); - $tmpcount = $result["count"]; + $domains = $this->getDomain("*", $active); + $nrofdomains = $domains["count"]; - return $tmpcount; + return $nrofdomains; } /** @@ -742,11 +732,10 @@ * This function counts systemUsers */ function systemuserCount () { - $tmp = listAdminUsers(); - $tmpcount = $tmp["count"]; + $systemusers = listAdminUsers(); + $nrofsystemusers = $systemusers["count"]; - return $tmpcount; - + return $nrofsystemusers; } /** @@ -754,19 +743,19 @@ * * This function checks if the submitted user is in the global admingroup * - * @user string uid= value of a user's dn + * @user_uid string uid= value of a user's dn */ - function isAdminUser ($user) { - $userdn = "uid=".$user.",".LDAP_USERS_ROOT_DN; + function isAdminUser ($user_uid) { + $is_admin = FALSE; + $user_dn = "uid=".$user_uid.",".LDAP_USERS_ROOT_DN; - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(member=$userdn)(cn=admingroup))"); - $result = ldap_get_entries($this->cid, $result); + $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(member=$user_dn)(cn=admingroup))"); + $entries = ldap_get_entries($this->cid, $result); - if ($result["count"] == 0) { - return false; - } else { - return true; + if ($entries["count"] > 0) { + $is_admin = TRUE; } + return $is_admin; } /** @@ -778,9 +767,9 @@ */ function getEntry($dn, $filter="(objectClass=*)", $attributes = array()) { $result = ldap_read($this->cid, $dn, $filter, $attributes); - $result = ldap_get_entries($this->cid, $result); + $entries = ldap_get_entries($this->cid, $result); - return $result; + return $entries; } } // vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-11 16:05:46
|
Revision: 127 http://elma.svn.sourceforge.net/elma/?rev=127&view=rev Author: tuxevara Date: 2007-07-11 09:05:34 -0700 (Wed, 11 Jul 2007) Log Message: ----------- new acl object added in config and templates renamed lots of variables in ldap_functions.inc.php to make usage clearer Modified Paths: -------------- trunk/includes/acl.inc.php trunk/includes/ldap_functions.inc.php trunk/modules/content_domain_edit.php trunk/templates/simple/banner.tpl trunk/templates/simple/content_domain_edit.tpl Modified: trunk/includes/acl.inc.php =================================================================== --- trunk/includes/acl.inc.php 2007-07-09 21:47:02 UTC (rev 126) +++ trunk/includes/acl.inc.php 2007-07-11 16:05:34 UTC (rev 127) @@ -2,7 +2,7 @@ // ACLs define ("ACL",serialize(array( - "systemadmin" => array("main","domains_list","domain_edit","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit","statistics"), + "systemadmin" => array("main","domains_list","domain_edit","domain_edit.mailstorageserver","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit","statistics"), "domainadmin" => array("main","domains_list","domain_edit","users_list","user_edit","user_delete","alias_edit","alias_delete","statistics"), "user" => array("main") ))); Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-09 21:47:02 UTC (rev 126) +++ trunk/includes/ldap_functions.inc.php 2007-07-11 16:05:34 UTC (rev 127) @@ -101,7 +101,10 @@ /** * listDomains - listing domains * - * This function lists any domain + * This function lists any domain, to which access is granted through LDAP ACLs. + * + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array array of ldap attributes to return, empty array returns everything */ function listDomains ($active="*", $attribute=array() ) { $domains = $this->getDomain("*", $active="*", $attribute=array()); @@ -111,18 +114,23 @@ /** * getDomain - gets information about domain(s) * - * This function get information about domain(s) inside the ldap-tree + * This function gets information about domain(s) from LDAP * - * when active is "TRUE" only active domains will be listed - * * @domain_dc string dc= value of a domain's DN - * @active string "*" for listing any, "TRUE" for listing active domains only + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array ldap attributes to return, empty array returns everything */ function getDomain ( $domain_dc="*", $active="*", $attribute=array() ) { $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(objectClass=mailDomain)(dc=$domain_dc)(mailStatus=$active))", $attribute); $domain = ldap_get_entries($this->cid, $result); + if (isset($domain[0])) { - if ( $domain_dc !== "*" ) $domain = $domain[0]; + if ( $domain_dc !== "*" ) { + $domain = $domain[0]; + if ( count($attribute) == 1 ) { + $domain = $domain[$attribute[0]]; + } + } } return $domain; } @@ -130,21 +138,23 @@ /** * addDomain - adds a domain * - * This functions adds a domain and an admingroup + * This functions adds a domain and an admingroup * the main-admin is included in this admingroup by default * - * @domain array information about the domain - * @admins array admin dns + * @domain array information about the domain + * @admins array admin dn's */ function addDomain ( $domain , $admins ) { $domain["objectclass"] = "mailDomain"; ldap_add($this->cid, "dc=".$domain['dc'].",".LDAP_DOMAINS_ROOT_DN, $domain); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { $result = 0; } + /* create the admingroup object */ array_push ($admins, LDAP_ADMIN_DN); $group["cn"] = "admingroup"; @@ -163,7 +173,19 @@ * @domain array information about the domain */ function modifyDomain ( $domain ) { + + /* set the mailstorage server for all domain users changed */ + if ( isset($domain["mailstorageserver"]) ) { + $domain_users = $this->listUsers($domain["dc"]); + for ($i=0; $i<$domain_users["count"]; $i++) { + $domain_user["uid"] = $domain_users[$i]["uid"][0]; + $domain_user["mailstorageserver"] = $domain["mailstorageserver"]; + $this->modifyUser($domain["dc"],$domain_user); + } + } + ldap_modify($this->cid,"dc=".$domain["dc"].",".LDAP_DOMAINS_ROOT_DN, $domain); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -181,6 +203,7 @@ */ function deleteDomain ( $domain ) { my_ldap_delete($this->cid,"dc=$domain,".LDAP_DOMAINS_ROOT_DN,true); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -197,10 +220,12 @@ * * This function lists any user in the specified domain * - * @domain string dc= value of a domain's DN + * @domain_dc string dc= value of a domain's DN + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array ldap attributes to return, empty array returns everything */ - function listUsers( $domain, $active="*", $attribute = array() ) { - $users = $this->getUser( $domain, "*", $active="*", $attribute ); + function listUsers( $domain_dc, $active="*", $attribute = array() ) { + $users = $this->getUser( $domain_dc, "*", $active="*", $attribute ); return $users; } @@ -209,12 +234,13 @@ * * This function gets information about a specific user * - * @domain string dc= value of a domain's DN where the user is in - * @user_uid string uid= value of the user's DN - * @active string "*" shows any user, "TRUE" shows active users only + * @domain_dc string dc= value of a domain's DN where the user is in + * @user_uid string uid= value of the user's DN + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array ldap attributes to return, empty array returns everything */ - function getUser ( $domain, $user_uid = "*", $active="*", $attribute = array() ) { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))", $attribute); + function getUser ( $domain_dc, $user_uid = "*", $active="*", $attribute = array() ) { + $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))", $attribute); $user = ldap_get_entries($this->cid, $result); if ( $user_uid !== "*" ) $user = $user[0]; return $user; @@ -225,12 +251,17 @@ * * This function adds a user to the ldap-tree * - * @domain string dc= value of the domain the user should belong to - * @user array information about the user + * @domain_dc string dc= value of the domain the user should belong to + * @user array information about the user */ - function addUser ( $domain, $user) { + function addUser ( $domain_dc, $user ) { + $user["mailStorageserver"] = $this->getDomain($domain_dc,"*",array("mailstorageserver")); + $user["mailStorageserver"] = $user["mailStorageserver"][0]; + $user["homeDirectory"] = DEFAULT_HOMEDIR_ROOT."/$domain_dc/".$user['uid']; $user["objectclass"] = "mailUser"; - ldap_add($this->cid, "uid=".$user['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $user); + + ldap_add($this->cid, "uid=".$user['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $user); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -244,11 +275,12 @@ * * This function modifies the information of a user * - * @domain string dc= value of the domain the user is in - * @user array information about the user + * @domain_dc string dc= value of the domain the user is in + * @user array information about the user */ - function modifyUser ( $domain, $user) { - ldap_modify($this->cid, "uid=".$user['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $user); + function modifyUser ( $domain_dc, $user ) { + ldap_modify($this->cid, "uid=".$user['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $user); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -260,13 +292,13 @@ /** * deleteUser - deleting a user * - * This function removes a user from the ldap-tree + * This function removes a user from the LDAP * (including his presence in any admingroup) * - * @domain string dc= value of the domain the user is in - * @user string uid= value of the users DN + * @domain_dc string dc= value of the domain the user is in + * @user_uid string uid= value of the users DN */ - function deleteUser ( $domain, $user) { + function deleteUser ( $domain_dc, $user_uid) { $searchresult = ldap_search($this->cid, LDAP_BASEDN, "(&(member=*)(cn=admingroup))"); $searchresult = ldap_get_entries($this->cid, $searchresult); @@ -276,6 +308,7 @@ $result = 0; } + /* find out where user is admin. guess this can be done easier. */ for ($i=0; $i<$searchresult["count"]; $i++) { for ($c=0; $c<$searchresult[$i]["member"]["count"]; $c++) { $member = explode(",", $searchresult[$i]["member"][$c]); @@ -296,7 +329,8 @@ } } - ldap_delete($this->cid, "uid=".$user.",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN); + ldap_delete($this->cid, "uid=".$user.",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -312,10 +346,12 @@ * * This function lists all aliases in a specific domain * - * @domain string dc= value of a domain's DN + * @domain string dc= value of a domain's DN + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array ldap attributes to return, empty array returns everything */ - function listAliases( $domain, $active="*", $attribute=array() ) { - $aliases = $this->getAlias( $domain, "*", $active="*", $attribute=array()); + function listAliases( $domain_dc, $active="*", $attribute=array() ) { + $aliases = $this->getAlias( $domain_dc, "*", $active="*", $attribute=array()); return $aliases; } @@ -324,12 +360,13 @@ * * This function gets information about an alias * - * @domain string dc= value of the domain the alias is in - * @alias_uid string uid= value of the alias - * @active string "*" lists any alias, "TRUE" lists active aliases only + * @domain_dc string dc= value of the domain the alias is in + * @alias_uid string uid= value if the alias, "*" returns all aliases for the given domain + * @active string "*" for listing all, "TRUE" for listing active only, "FALSE" for listing inactive only + * @attribute array ldap attributes to return, empty array returns everything */ - function getAlias ( $domain, $alias_uid = "*", $active="*", $attribute=array() ) { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid)(mailStatus=$active))", $attribute); + function getAlias ( $domain_dc, $alias_uid = "*", $active="*", $attribute=array() ) { + $result = ldap_list($this->cid, "dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid)(mailStatus=$active))", $attribute); $alias = ldap_get_entries($this->cid, $result); if ( $alias_uid !== "*" ) $alias = $alias[0]; return $alias; @@ -340,12 +377,13 @@ * * This function add an alias to the specified domain * - * @domain string dc= value of a domain's DN - * @alias array information about an alias + * @domain_dc string dc= value of a domain's DN + * @alias array information about an alias */ - function addAlias ( $domain, $alias) { + function addAlias ( $domain_dc, $alias) { $alias["objectclass"] = "mailAlias"; - ldap_add($this->cid, "uid=".$alias['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $alias); + ldap_add($this->cid, "uid=".$alias['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $alias);a + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -359,11 +397,12 @@ * * This function modifies an alias in a specific domain * - * @domain string dc= value of a domain's DN - * @alias array information about the alias + * @domain_dc string dc= value of a domain's DN + * @alias array information about the alias */ - function modifyAlias ( $domain, $alias ) { - ldap_modify($this->cid, "uid=".$alias['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $alias); + function modifyAlias ( $domain_dc, $alias ) { + ldap_modify($this->cid, "uid=".$alias['uid'].",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN, $alias); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -377,11 +416,12 @@ * * This function deletes an alias inside a specific domain * - * @domain string dc= value of a domain's DN - * @alias string uid= value of the alias + * @domain_dc string dc= value of a domain's DN + * @alias_uid string uid= value of the alias's DN */ - function deleteAlias ( $domain, $alias ) { - ldap_delete($this->cid, "uid=".$alias.",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN); + function deleteAlias ( $domain, $alias_uid ) { + ldap_delete($this->cid, "uid=".$alias_uid.",dc=".$domain_dc.",".LDAP_DOMAINS_ROOT_DN); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -399,10 +439,11 @@ * * This function is used to link to the getSystemUser function only * + * @attributes array ldap attributes to return, empty array returns everything */ - function listSystemUsers ($attributes = array()) { - $users = $this->getSystemUser("*", $attributes); - return $users; + function listSystemUsers ( $attributes = array() ) { + $systemusers = $this->getSystemUser("*", $attributes); + return $systemusers; } /** @@ -410,21 +451,18 @@ * * This function returns information about systemusers * - * when user_uid is set information about this user will be returned only - * when user_uid has no value or "*" it will return information about all systemusers - * - * @user_uid string a uid= value - * + * @user_uid string uid= value of systemuser, "*" returns all systemusers + * @attributes array ldap attributes to return, empty array returns everything */ - function getSystemUser ( $user_uid = "*", $attributes = array() ) { - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(objectclass=inetOrgPerson)(uid=$user_uid))", $attributes); - $user = ldap_get_entries($this->cid, $result); + function getSystemUser ( $systemuser_uid = "*", $attributes = array() ) { + $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(objectclass=inetOrgPerson)(uid=$systemuser_uid))", $attributes); + $systemuser = ldap_get_entries($this->cid, $result); - if ($user_uid != "*") { - $user = $user[0]; + if ($systemuser_uid != "*") { + $systemuser = $systemuser[0]; } - return $user; + return $systemuser; } /** @@ -432,13 +470,13 @@ * * This function will add a systemuser using the submitted information * - * @user array an array of information about the user + * @systemuser array information about the systemuser */ - function addSystemUser ( $user ) { - $user["objectClass"][0] = "inetOrgPerson"; - $user["objectClass"][1] = "simpleSecurityObject"; + function addSystemUser ( $systemuser ) { + $systemuser["objectClass"][0] = "inetOrgPerson"; + $systemuser["objectClass"][1] = "simpleSecurityObject"; - ldap_add($this->cid, "uid=".$user['uid'].",".LDAP_USERS_ROOT_DN, $user); + ldap_add($this->cid, "uid=".$systemuser['uid'].",".LDAP_USERS_ROOT_DN, $systemuser); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -454,10 +492,10 @@ * This function will modify the information of a systemuser using * the submitted information * - * @user array an array of information about the user + * @systemuser array information about the systemuser */ - function modifySystemUser ( $user ) { - ldap_modify($this->cid, "uid=".$user['uid'].",".LDAP_USERS_ROOT_DN, $user); + function modifySystemUser ( $systemuser ) { + ldap_modify($this->cid, "uid=".$systemuser['uid'].",".LDAP_USERS_ROOT_DN, $systemuser); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -472,18 +510,18 @@ * * This function will remove a systemUser and his entries in all adminsgroups he's in * - * @user string the uid= value of the user's dn + * @systemuser string uid= value of the systemuser's DN */ - function deleteSystemUser ( $user ) { + function deleteSystemUser ( $systemuser ) { /* delete admin from admingroups where neccessary */ - $adminofdomains = $this->getSystemUsersDomains($user); + $adminofdomains = $this->getSystemUsersDomains($systemuser); foreach ($adminofdomains as $adminofdomain) { - $this->delAdminUsers($adminofdomain, "uid=$user,".LDAP_USERS_ROOT_DN); + $this->delAdminUsers($adminofdomain, "uid=$systemuser,".LDAP_USERS_ROOT_DN); } /* if the above was successfull delete the user object */ if ($result == 0) { - ldap_delete($this->cid, "uid=".$user.",".LDAP_USERS_ROOT_DN); + ldap_delete($this->cid, "uid=".$systemuser.",".LDAP_USERS_ROOT_DN); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -503,16 +541,16 @@ * This function returns all domain names for which the given * system user has administraive rights. * - * @user string the uid= value of the user's dn + * @systemuser_uid string uid= value of systemuser's DN */ - function getSystemUsersDomains ( $user ) { + function getSystemUsersDomains ( $systemuser_uid ) { - $userdn = "uid=".$user.",".LDAP_USERS_ROOT_DN; - $search_result = ldap_search($this->cid, LDAP_DOMAINS_ROOT_DN, "(member=$userdn)"); + $systemuserdn = "uid=".$systemuser_uid.",".LDAP_USERS_ROOT_DN; + $search_result = ldap_search($this->cid, LDAP_DOMAINS_ROOT_DN, "(member=$systemuserdn)"); $domains_dn = ldap_get_entries($this->cid, $search_result); unset($domains_dn["count"]); - // extract the domain name from each dn found + /* extract the domain name from each dn found */ $domains = array(); foreach($domains_dn as $domain_dn) { $domain = ldap_explode_dn($domain_dn["dn"], 1); @@ -712,6 +750,26 @@ } /** + * isAdminUser - checks if user is global admin + * + * This function checks if the submitted user is in the global admingroup + * + * @user string uid= value of a user's dn + */ + function isAdminUser ($user) { + $userdn = "uid=".$user.",".LDAP_USERS_ROOT_DN; + + $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(member=$userdn)(cn=admingroup))"); + $result = ldap_get_entries($this->cid, $result); + + if ($result["count"] == 0) { + return false; + } else { + return true; + } + } + + /** * getEntry - gets a specific Entry * * This function gets a specific Entry from the ldap tree Modified: trunk/modules/content_domain_edit.php =================================================================== --- trunk/modules/content_domain_edit.php 2007-07-09 21:47:02 UTC (rev 126) +++ trunk/modules/content_domain_edit.php 2007-07-11 16:05:34 UTC (rev 127) @@ -52,7 +52,8 @@ { $domain = $_GET["domain"]; $this->smarty->assign("domain",$domain); - + $this->smarty->assign("mailstorageservers",unserialize(MAILSTORAGESERVERS)); + // new domain created or existing domain altert if (isset($_POST["submit"])) { // remove all non LDAP objects from submited form @@ -130,7 +131,7 @@ if ($domain == "new") { $this->smarty->assign("mode","add"); $this->smarty->assign("domain",array()); - + $systemusers = $this->ldap->listSystemUsers(); unset($systemusers["count"]); Modified: trunk/templates/simple/banner.tpl =================================================================== --- trunk/templates/simple/banner.tpl 2007-07-09 21:47:02 UTC (rev 126) +++ trunk/templates/simple/banner.tpl 2007-07-11 16:05:34 UTC (rev 127) @@ -1,9 +1,13 @@ <div id="Banner"> <h1>ELMA - Exim LDAP Mail Administrator - v0.2</h1> </div> + <!-- WILL BE IMPLEMENTET IN THE NEXT RELEASE <div id="Pathfinder"> {$get.module} > {$get.domain} > {$get.user} </div> + --> + + {* // vim:tabstop=4:expandtab:shiftwidth=4:filetype=smarty:syntax:ruler: *} Modified: trunk/templates/simple/content_domain_edit.tpl =================================================================== --- trunk/templates/simple/content_domain_edit.tpl 2007-07-09 21:47:02 UTC (rev 126) +++ trunk/templates/simple/content_domain_edit.tpl 2007-07-11 16:05:34 UTC (rev 127) @@ -39,7 +39,21 @@ <input type="checkbox" name="mailstatus" {if $domain.mailstatus.0 eq "TRUE"}checked="checked"{/if} /> </td> </tr> + {if @in_array("domain_edit.mailstorageserver",$acl) } <tr> + <td> + {t}Mailstorageserver{/t} + </td> + <td> + <select name="mailstorageserver"> + {foreach from=$mailstorageservers item=server} + <option {if $domain.mailstorageserver.0 eq $server}selected{/if}>{$server}</option> + {/foreach} + </select> + </td> + </tr> + {/if} + <tr> <td colspan="2"> <hr /> </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-09 21:47:06
|
Revision: 126 http://elma.svn.sourceforge.net/elma/?rev=126&view=rev Author: tuxevara Date: 2007-07-09 14:47:02 -0700 (Mon, 09 Jul 2007) Log Message: ----------- added "pathfinder", displays where you are right now Modified Paths: -------------- trunk/index.php trunk/templates/simple/banner.tpl trunk/templates/simple/style.css Modified: trunk/index.php =================================================================== --- trunk/index.php 2007-07-09 21:19:07 UTC (rev 125) +++ trunk/index.php 2007-07-09 21:47:02 UTC (rev 126) @@ -64,6 +64,7 @@ $smarty->assign('username',$_SESSION['username']); $smarty->assign('userclass',$_SESSION['userclass']); $smarty->assign('acl',$acl[$_SESSION['userclass']]); + $smarty->assign('get',$_GET); $content = $content_module->getContent(); } else { Modified: trunk/templates/simple/banner.tpl =================================================================== --- trunk/templates/simple/banner.tpl 2007-07-09 21:19:07 UTC (rev 125) +++ trunk/templates/simple/banner.tpl 2007-07-09 21:47:02 UTC (rev 126) @@ -1,6 +1,9 @@ <div id="Banner"> <h1>ELMA - Exim LDAP Mail Administrator - v0.2</h1> </div> + <div id="Pathfinder"> + {$get.module} > {$get.domain} > {$get.user} + </div> {* // vim:tabstop=4:expandtab:shiftwidth=4:filetype=smarty:syntax:ruler: *} Modified: trunk/templates/simple/style.css =================================================================== --- trunk/templates/simple/style.css 2007-07-09 21:19:07 UTC (rev 125) +++ trunk/templates/simple/style.css 2007-07-09 21:47:02 UTC (rev 126) @@ -23,6 +23,15 @@ padding: 0; } +/* Pathfinder */ +div#Pathfinder { + margin: 0em 0em 0em 7.5em; + padding: 0 0 0 0.5em; + color: blue; + border-bottom: 1px black solid; + border-left: 1px black solid; +} + /* Navigation elements */ div#Navigation { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-09 21:19:13
|
Revision: 125 http://elma.svn.sourceforge.net/elma/?rev=125&view=rev Author: tuxevara Date: 2007-07-09 14:19:07 -0700 (Mon, 09 Jul 2007) Log Message: ----------- replaced nice boxed "for-loops" with appropriate array functions unified ldap function parameters Modified Paths: -------------- trunk/includes/ldap_functions.inc.php trunk/includes/my_functions.inc.php trunk/modules/content_domain_edit.php trunk/modules/content_globaladmins_edit.php trunk/modules/content_systemuser_delete.php trunk/modules/content_systemuser_edit.php trunk/templates/simple/content_domain_edit.tpl Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/includes/ldap_functions.inc.php 2007-07-09 21:19:07 UTC (rev 125) @@ -103,8 +103,8 @@ * * This function lists any domain */ - function listDomains () { - $domains = $this->getDomain("*"); + function listDomains ($active="*", $attribute=array() ) { + $domains = $this->getDomain("*", $active="*", $attribute=array()); return $domains; } @@ -118,8 +118,8 @@ * @domain_dc string dc= value of a domain's DN * @active string "*" for listing any, "TRUE" for listing active domains only */ - function getDomain ($domain_dc = "*", $active="*") { - $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(mailStatus=$active)(dc=$domain_dc))"); + function getDomain ( $domain_dc="*", $active="*", $attribute=array() ) { + $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(objectClass=mailDomain)(dc=$domain_dc)(mailStatus=$active))", $attribute); $domain = ldap_get_entries($this->cid, $result); if (isset($domain[0])) { if ( $domain_dc !== "*" ) $domain = $domain[0]; @@ -199,8 +199,8 @@ * * @domain string dc= value of a domain's DN */ - function listUsers( $domain ) { - $users = $this->getUser( $domain ); + function listUsers( $domain, $active="*", $attribute = array() ) { + $users = $this->getUser( $domain, "*", $active="*", $attribute ); return $users; } @@ -213,12 +213,8 @@ * @user_uid string uid= value of the user's DN * @active string "*" shows any user, "TRUE" shows active users only */ - function getUser ( $domain, $user_uid = "*", $active = "*") { - if ($active == "*") { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))"); - } else { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(mailStatus=$active)(&(objectclass=mailUser)(uid=*)))"); - } + function getUser ( $domain, $user_uid = "*", $active="*", $attribute = array() ) { + $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))", $attribute); $user = ldap_get_entries($this->cid, $result); if ( $user_uid !== "*" ) $user = $user[0]; return $user; @@ -318,8 +314,8 @@ * * @domain string dc= value of a domain's DN */ - function listAliases( $domain ) { - $aliases = $this->getAlias( $domain ); + function listAliases( $domain, $active="*", $attribute=array() ) { + $aliases = $this->getAlias( $domain, "*", $active="*", $attribute=array()); return $aliases; } @@ -332,12 +328,8 @@ * @alias_uid string uid= value of the alias * @active string "*" lists any alias, "TRUE" lists active aliases only */ - function getAlias ( $domain, $alias_uid = "*", $active = "*") { - if ($active == "*") { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid))"); - } else { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(mailStatus=$active)(&(objectclass=mailAlias)(uid=*)))"); - } + function getAlias ( $domain, $alias_uid = "*", $active="*", $attribute=array() ) { + $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid)(mailStatus=$active))", $attribute); $alias = ldap_get_entries($this->cid, $result); if ( $alias_uid !== "*" ) $alias = $alias[0]; return $alias; @@ -370,7 +362,7 @@ * @domain string dc= value of a domain's DN * @alias array information about the alias */ - function modifyAlias ( $domain, $alias) { + function modifyAlias ( $domain, $alias ) { ldap_modify($this->cid, "uid=".$alias['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $alias); if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); @@ -388,7 +380,7 @@ * @domain string dc= value of a domain's DN * @alias string uid= value of the alias */ - function deleteAlias ( $domain, $alias) { + function deleteAlias ( $domain, $alias ) { ldap_delete($this->cid, "uid=".$alias.",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN); if ( ldap_errno($this->cid) !== 0 ) { @@ -407,10 +399,9 @@ * * This function is used to link to the getSystemUser function only * - * @mode string used to choose the filter options */ - function listSystemUsers ($mode="system") { - $users = $this->getSystemUser("*", $mode); + function listSystemUsers ($attributes = array()) { + $users = $this->getSystemUser("*", $attributes); return $users; } @@ -422,21 +413,15 @@ * when user_uid is set information about this user will be returned only * when user_uid has no value or "*" it will return information about all systemusers * - * when mode is set to "system" only users with readable userPassword-attribute will be listed - * * @user_uid string a uid= value - * @mode string used for choosing the filter options + * */ - function getSystemUser ($user_uid="*", $mode="system") { - if ($mode!="system") { - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(objectclass=inetOrgPerson)(uid=$user_uid))"); - } else { - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(userPassword=*)(&(objectclass=inetOrgPerson)(uid=$user_uid)))"); - } + function getSystemUser ( $user_uid = "*", $attributes = array() ) { + $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(objectclass=inetOrgPerson)(uid=$user_uid))", $attributes); $user = ldap_get_entries($this->cid, $result); if ($user_uid != "*") { - $user = $user[0]; + $user = $user[0]; } return $user; @@ -454,6 +439,7 @@ $user["objectClass"][1] = "simpleSecurityObject"; ldap_add($this->cid, "uid=".$user['uid'].",".LDAP_USERS_ROOT_DN, $user); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -463,15 +449,16 @@ } /** - * modSystemUser - modifies a systemUser's info + * modifySystemUser - modifies a systemUser's info * * This function will modify the information of a systemuser using * the submitted information * * @user array an array of information about the user */ - function modSystemUser ( $user ) { + function modifySystemUser ( $user ) { ldap_modify($this->cid, "uid=".$user['uid'].",".LDAP_USERS_ROOT_DN, $user); + if ( ldap_errno($this->cid) !== 0 ) { $result = ldap_error($this->cid); } else { @@ -487,36 +474,14 @@ * * @user string the uid= value of the user's dn */ - function delSystemUser ( $user ) { - $result = 1; - - $searchresult = ldap_search($this->cid, LDAP_BASEDN, "(&(member=*)(cn=admingroup))"); - $searchresult = ldap_get_entries($this->cid, $searchresult); - - if ( ldap_errno($this->cid) !== 0 ) { - $result = ldap_error($this->cid); - } else { - $result = 0; + function deleteSystemUser ( $user ) { + /* delete admin from admingroups where neccessary */ + $adminofdomains = $this->getSystemUsersDomains($user); + foreach ($adminofdomains as $adminofdomain) { + $this->delAdminUsers($adminofdomain, "uid=$user,".LDAP_USERS_ROOT_DN); } - for ($i=0; $i<$searchresult["count"]; $i++) { - for ($c=0; $c<$searchresult[$i]["member"]["count"]; $c++) { - $member = explode(",", $searchresult[$i]["member"][$c]); - - if (($member[0] == "uid=".$user) && ($member[1].",".$member[2] == LDAP_USERS_ROOT_DN)) { - $del["member"] = array($searchresult[$i]["member"][$c]); - ldap_mod_del($this->cid, $searchresult[$i]["dn"], $del); - } - - if ( ldap_errno($this->cid) !== 0 ) { - $result = ldap_error($this->cid); - return $result; - } else { - $result = 0; - } - } - } - + /* if the above was successfull delete the user object */ if ($result == 0) { ldap_delete($this->cid, "uid=".$user.",".LDAP_USERS_ROOT_DN); @@ -525,6 +490,8 @@ } else { $result = 0; } + } else { + $result = 1; } return $result; @@ -533,7 +500,8 @@ /** * getSystemUsersDomain - lists administrated domains * - * This function returns all domains the submitted user administrates + * This function returns all domain names for which the given + * system user has administraive rights. * * @user string the uid= value of the user's dn */ @@ -557,51 +525,41 @@ # ADMINGROUP /** - * listAdminUsers - links to the getAdminUser function + * listAdminUsers - lists users from the given domain's admin group * - * This function is used to link to the getAdminUser function only + * This function lists all users listed in a domain's admingroup. * * @domain string dc= value of a domain + * @dn_only boolean should only the dn be returned */ - function listAdminUsers ($domain="users") { - $users = $this->getAdminUser($domain); - return $users; - } - - /** - * getAdminUser - lists users from an admingroup - * - * This function lists all users (excluding the main-admin) - * listed in the global or a domain's admingroup - * - * when domain is not set the global admingroup will be used instead - * - * @domain string dc= value of a domain's dn - */ - function getAdminUser ($domain="users") { - if ($domain != "users") { - $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "cn=admingroup"); - $user = ldap_get_entries($this->cid, $result); + function listAdminUsers ($domain=null, $dn_only = "FALSE") { + if ( $domain != null ) { + $result = ldap_read($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN,"member=*"); } else { - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(cn=admingroup)"); - $user = ldap_get_entries($this->cid, $result); + $result = ldap_read($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN,"member=*"); } + $admingroup = ldap_get_entries($this->cid, $result); - if (isset($user[0])) { - $tmp = $user[0]["member"]; - $user[0]["member"] = array(); - $user[0]["member"]["count"] = $tmp["count"]; + $adminusers_dn = $admingroup[0]["member"]; + unset($adminusers_dn["count"]); - for ($i=0; $i<$tmp["count"]; $i++) { - if (!($tmp[$i] == LDAP_ADMIN_DN)) { - array_push($user[0]["member"], $tmp[$i]); - } else { - $user[0]["member"]["count"]--; - } + /* remove the LDAP_ADMIN_DN from the list, because + * it should never be shown in the frontend. + */ + $admin_key = array_search(LDAP_ADMIN_DN, $adminusers_dn); + if ( $admin_key !== "" ) { + unset ($adminusers_dn[$admin_key]); + } + + if ( $dn_only != "TRUE" ) { + $adminusers = array(); + foreach ($adminusers_dn as $adminuser) { + $adminusers = array_merge($adminusers,$this->getEntry($adminuser)); } + } else { + $adminusers = $adminusers_dn; } - - return $user; + return $adminusers; } /** @@ -614,14 +572,13 @@ * @domain string dc= value of a domain's dn * @users array dn's of one or more users */ - function addAdminUsers ($domain=null, $users) { + function addAdminUsers ($domain=null, $newadmins=array()) { + $admingroup["member"] = $newadmins; - $tmpusers["member"] = $users; - if ($domain != null) { - ldap_mod_add($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $tmpusers); + ldap_mod_add($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $admingroup); } else { - ldap_mod_add($this->cid, "cn=admingroup,".LDAP_USERS_ROOT_DN, $tmpusers); + ldap_mod_add($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN, $admingroup); } if ( ldap_errno($this->cid) !== 0 ) { @@ -642,14 +599,15 @@ * @domain string dc= value of a domain's dn * @users array dn's of one or more users */ - function delAdminUsers ($domain=null, $users) { + function deleteAdminUsers ($domain=null, $users) { - $tmpusers["member"] = $users; - - if ($domain != null) { - ldap_mod_del($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $tmpusers); - } else { - ldap_mod_del($this->cid, "cn=admingroup,".LDAP_USERS_ROOT_DN, $tmpusers); + if ( count($users) > 0 ) { + $admins["member"] = $users; + if ($domain != null) { + ldap_mod_del($this->cid, "cn=admingroup,dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $admins); + } else { + ldap_mod_del($this->cid, LDAP_ADMIN_GROUP.",".LDAP_USERS_ROOT_DN, $admins); + } } if ( ldap_errno($this->cid) !== 0 ) { @@ -660,26 +618,6 @@ return $result; } - /** - * isAdminUser - checks if user is global admin - * - * This function checks if the submitted user is in the global admingroup - * - * @user string uid= value of a user's dn - */ - function isAdminUser ($user) { - $userdn = "uid=".$user.",".LDAP_USERS_ROOT_DN; - - $result = ldap_list($this->cid, LDAP_USERS_ROOT_DN, "(&(member=$userdn)(cn=admingroup))"); - $result = ldap_get_entries($this->cid, $result); - - if ($result["count"] == 0) { - return false; - } else { - return true; - } - } - # Statistical functions /** @@ -780,12 +718,11 @@ * * @dn string a ldap dn */ - function getEntry($dn) { - $result = ldap_read($this->cid, $dn, "(objectClass=*)"); + function getEntry($dn, $filter="(objectClass=*)", $attributes = array()) { + $result = ldap_read($this->cid, $dn, $filter, $attributes); $result = ldap_get_entries($this->cid, $result); return $result; } - } // vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Modified: trunk/includes/my_functions.inc.php =================================================================== --- trunk/includes/my_functions.inc.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/includes/my_functions.inc.php 2007-07-09 21:19:07 UTC (rev 125) @@ -30,10 +30,13 @@ /** * wrapper around print_r function */ -function my_print_r ( $data ) { +function my_print_r ( $data , $header="") { + echo "<div align='left' style='border: 2px red solid; background-color: lightgray; padding: 10px; margin: 10px; font-size: 10'>"; echo "<pre>"; + if ( strlen($header) > 0 ) echo "<h1>$header</h1>"; print_r($data); echo "</pre>"; + echo "</div>"; } /** @@ -144,4 +147,14 @@ return $valid_data; } +function my_serialize(&$array,$position) { + $array = serialize($array); +} + +function my_unserialize(&$array,$position) { + $array = unserialize($array); +} + + + // vim:tabstop=4:expandtab:shiftwidth=4:filetype=php:syntax:ruler: Modified: trunk/modules/content_domain_edit.php =================================================================== --- trunk/modules/content_domain_edit.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/modules/content_domain_edit.php 2007-07-09 21:19:07 UTC (rev 125) @@ -91,53 +91,24 @@ case "modify": $this->ldap->modifyDomain($my_domain); - $ldapadmins = $this->ldap->listAdminUsers($domain); - - $count = 0; + $admins_cur = $this->ldap->listAdminUsers($domain, TRUE); if (!isset($admins)) { $admins = array(); + //array_push ($admins, LDAP_ADMIN_DN); } /* create array of new admins */ - foreach ($admins as $admin) { - $isinarray = 0; - for ($c=0; $c < $ldapadmins[0]["member"]["count"]; $c++) { - if ($admin == $ldapadmins[0]["member"][$c]){ - $isinarray = 1; - break; - } - } - - if ($isinarray == 0) { - $adminsadd[$count] = $admin; - $count++; - } - } - - $count = 0; - + $adminsadd = array_values(array_diff($admins,$admins_cur)); + /* create array of removed admins */ - for ($i=0; $i < $ldapadmins[0]["member"]["count"]; $i++) { - $isinarray = 0; - foreach ($admins as $admin) { - if ($ldapadmins[0]["member"][$i] == $admin) { - $isinarray = 1; - break; - } - } + $adminsdel = array_values(array_diff($admins_cur,$admins)); - if ($isinarray == 0) { - $adminsdel[$count] = $ldapadmins[0]["member"][$i]; - $count++; - } - } - - if (isset($adminsadd)) { + if ( count($adminsadd) > 0 ) { $this->ldap->addAdminUsers($domain, $adminsadd); } - if (isset($adminsdel)) { - $this->ldap->delAdminUsers($domain, $adminsdel); + if ( count($adminsdel) > 0 ) { + $this->ldap->deleteAdminUsers($domain, $adminsdel); } break; } @@ -160,97 +131,51 @@ $this->smarty->assign("mode","add"); $this->smarty->assign("domain",array()); - $users = $this->ldap->listSystemUsers(); + $systemusers = $this->ldap->listSystemUsers(); + unset($systemusers["count"]); - if (isset($users)) { - unset($users["count"]); - - $tmpusers = $users; - $users = array(); - - foreach ($tmpusers as $user) { - $user["mailUser"] = 0; - array_push($users, $user); - } - - $tmp["sysUser"] = 1; - - $this->smarty->assign("nonadmins", $users); - $this->smarty->assign("notnullnonadmins", $tmp); - } + $this->smarty->assign("nonadmins", $systemusers); } else { $this->smarty->assign("mode","modify"); $this->smarty->assign("domain",$this->ldap->getDomain($domain)); - $tmpadmins = $this->ldap->listAdminUsers($domain); - $tmpusers = $this->ldap->listSystemUsers(); - $mailusers = $this->ldap->listUsers($domain); + /* create a users/admin array from system- and mailusers + * and unset the count key from users/admins array + * to have useful arrays for the smarty output. + * serializing is neccessary to diff the multidimensional + * arrays. + */ - $users = array(); - $admins = array(); + $systemusers = $this->ldap->listSystemUsers(); + if ( count($systemusers) == 0 ) $systemusers = array(); + unset($systemusers["count"]); - unset($tmpusers["count"]); + $mailusers = $this->ldap->listUsers($domain); + if ( count($mailusers) == 0 ) $mailusers = array(); unset($mailusers["count"]); + + $nonadmins = array_merge($systemusers,$mailusers); + if ( count($nonadmins) == 0 ) $nonadmins = array(); + unset($nonadmins["count"]); - foreach ($tmpusers as $tmpuser) { - array_push($users, $tmpuser); - } + $admins = $this->ldap->listAdminUsers($domain); + if ( count($admins) == 0 ) $admins = array(); + unset($admins["count"]); - foreach ($mailusers as $mailuser) { - array_push($users, $mailuser); - } + array_walk($nonadmins,'my_serialize'); + array_walk($admins,'my_serialize'); + + $nonadmins = array_values(array_diff($nonadmins,$admins)); - $tmpusers = $users; - $users = array(); + array_walk($admins,'my_unserialize'); + array_walk($nonadmins,'my_unserialize'); - if (isset($tmpadmins[0])) { - foreach ($tmpusers as $user) - { - $isset = 0; - unset ($tmpadmins[0]["member"]["count"]); - - foreach ($tmpadmins[0]["member"] as $admin) { - if ($user["dn"] == $admin) { - $isset = 1; - $tmp = $this->ldap->getEntry($admin); - if (strstr($tmp[0]["dn"], LDAP_DOMAINS_ROOT_DN)) { - $tmp[0]["mailUser"] = 1; - $notnulladmins["mailUser"] = 1; - } else { - $tmp[0]["mailUser"] = 0; - $notnulladmins["sysUser"] = 1; - } - array_push($admins, $tmp[0]); - break; - } - } - - if ($isset == 0) { - if (strstr($user["dn"], LDAP_DOMAINS_ROOT_DN)) { - $user["mailUser"] = 1; - $notnullusers["mailUser"] = 1; - } else { - $user["mailUser"] = 0; - $notnullusers["sysUser"] = 1; - } - array_push($users, $user); - } - } - } else { - } - if (isset($admins)) { $this->smarty->assign("admins", $admins); - if (isset($notnulladmins)) { - $this->smarty->assign("notnulladmins", $notnulladmins); - } } - if (isset($users)) { - $this->smarty->assign("nonadmins", $users); - if (isset($notnullusers)) { - $this->smarty->assign("notnullnonadmins", $notnullusers); - } + if (isset($nonadmins)) { + $this->smarty->assign("nonadmins", $nonadmins); } } } Modified: trunk/modules/content_globaladmins_edit.php =================================================================== --- trunk/modules/content_globaladmins_edit.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/modules/content_globaladmins_edit.php 2007-07-09 21:19:07 UTC (rev 125) @@ -61,66 +61,30 @@ unset($my_domain["admins"]); } - if (isset($_POST["nonadmins"])) { - $nonadmins = $my_domain["nonadmins"]; - unset($my_domain["nonadmins"]); - } - unset($my_domain["submit"]); - $ldapadmins = $this->ldap->listAdminUsers(); + $admins_cur = $this->ldap->listAdminUsers(null,"TRUE"); - $count = 0; + if (!isset($admins)) { + $admins = array(); + } /* create array of new admins */ - if (isset($admins)) { - foreach ($admins as $admin) { - $isinarray = 0; - for ($c=0; $c < $ldapadmins[0]["member"]["count"]; $c++) { - if ($admin == $ldapadmins[0]["member"][$c]){ - $isinarray = 1; - break; - } - } + $adminsadd = array_values(array_diff($admins,$admins_cur)); - if ($isinarray == 0) { - $adminsadd[$count] = $admin; - $count++; - } - } - - $count = 0; - } - /* create array of removed admins */ - for ($i=0; $i < $ldapadmins[0]["member"]["count"]; $i++) { - $isinarray = 0; - - if (isset($admins)) { - foreach ($admins as $admin) { - if ($ldapadmins[0]["member"][$i] == $admin) { - $isinarray = 1; - break; - } - } - } + $adminsdel = array_values(array_diff($admins_cur,$admins)); - if ($isinarray == 0) { - $adminsdel[$count] = $ldapadmins[0]["member"][$i]; - $count++; - } - } - /* add admins to ldap if neccesary */ - if (isset($adminsadd)) { + if ( count($adminsadd) > 0 ) { $this->ldap->addAdminUsers(null, $adminsadd); } - + /* delete admins from ldap if neccesary */ - if (isset($adminsdel)) { - $this->ldap->delAdminUsers(null, $adminsdel); + if ( count($adminsdel) > 0 ) { + $this->ldap->deleteAdminUsers(null, $adminsdel); } - + $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { $this->smarty->assign("submit_status",$submit_status); @@ -132,47 +96,30 @@ } $this->smarty->assign("mode","modify"); - - $admins = $this->ldap->listAdminUsers(); - $users = $this->ldap->listSystemUsers(); - $tmpadmins = $this->ldap->listAdminUsers(); - $users = $this->ldap->listSystemUsers(); - $admins = array(); + $systemusers = $this->ldap->listSystemUsers(); + if ( count($systemusers) == 0 ) $systemusers = array(); + unset($systemusers["count"]); - unset($users["count"]); + $admins = $this->ldap->listAdminUsers(); + if ( count($admins) == 0 ) $admins = array(); + unset($admins["count"]); - $tmpusers = $users; - $users = array(); + array_walk($systemusers,'my_serialize'); + array_walk($admins,'my_serialize'); - if (isset($tmpadmins[0])) { - foreach ($tmpusers as $user) - { - $isset = 0; - unset ($tmpadmins[0]["member"]["count"]); + $nonadmins = array_values(array_diff($systemusers,$admins)); - foreach ($tmpadmins[0]["member"] as $admin) { - if ($user["dn"] == $admin) { - $isset = 1; - $tmp = $this->ldap->getEntry($admin); - array_push($admins, $tmp[0]); - break; - } - } + array_walk($admins,'my_unserialize'); + array_walk($nonadmins,'my_unserialize'); - if ($isset == 0) { - array_push($users, $user); - } - } - } - if (isset($admins)) { $this->smarty->assign("admins", $admins); } - if (isset($users)) { - $this->smarty->assign("nonadmins", $users); + if (isset($nonadmins)) { + $this->smarty->assign("nonadmins", $nonadmins); } } Modified: trunk/modules/content_systemuser_delete.php =================================================================== --- trunk/modules/content_systemuser_delete.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/modules/content_systemuser_delete.php 2007-07-09 21:19:07 UTC (rev 125) @@ -51,7 +51,7 @@ { if ( isset($_POST["submit"]) ) { $uid = $_POST["uid"]; - $this->ldap->delSystemUser($uid); + $this->ldap->deleteSystemUser($uid); $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { Modified: trunk/modules/content_systemuser_edit.php =================================================================== --- trunk/modules/content_systemuser_edit.php 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/modules/content_systemuser_edit.php 2007-07-09 21:19:07 UTC (rev 125) @@ -68,9 +68,9 @@ $my_systemuser["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_systemuser["clearpassword"]))); } - if (! defined(SAVECLEARPASS) || empty($my_systemuser["clearpassword"])) { + //if (! defined(SAVECLEARPASS) || empty($my_systemuser["clearpassword"])) { unset($my_systemuser["clearpassword"]); - } + // } $validation_errors = validate_systemuser($my_systemuser); if (count($validation_errors) == 0) { @@ -79,15 +79,16 @@ $this->ldap->addSystemUser($my_systemuser); break; case "modify": + if ( count($new_adminofdomains) == 0) $new_adminofdomains = array(); $old_adminofdomains = $this->ldap->getSystemUsersDomains($systemuser); unset ($my_systemuser["adminofdomains"]); - $this->ldap->modSystemUser($my_systemuser); + $this->ldap->modifySystemUser($my_systemuser); $addDomainAdmin = array(); $delDomainAdmin = array(); + - /* check if the user is admin already */ /* and put him onto the add array if not */ $addDomainAdmin = array_diff($new_adminofdomains,$old_adminofdomains); @@ -96,15 +97,15 @@ /* and put him onto the del array if he isn't any longer */ $delDomainAdmin = array_diff($old_adminofdomains,$new_adminofdomains); - if (isset($addDomainAdmin)) { + if ( count($addDomainAdmin) > 0 ) { foreach($addDomainAdmin as $domain) { $this->ldap->addAdminUsers($domain, "uid=".$systemuser.",".LDAP_USERS_ROOT_DN); } } - if (isset($delDomainAdmin)) { + if ( count($delDomainAdmin) > 0) { foreach($delDomainAdmin as $domain) { - $this->ldap->delAdminUsers($domain, "uid=".$systemuser.",".LDAP_USERS_ROOT_DN); + $this->ldap->deleteAdminUsers($domain, "uid=".$systemuser.",".LDAP_USERS_ROOT_DN); } } break; Modified: trunk/templates/simple/content_domain_edit.tpl =================================================================== --- trunk/templates/simple/content_domain_edit.tpl 2007-07-06 10:49:01 UTC (rev 124) +++ trunk/templates/simple/content_domain_edit.tpl 2007-07-09 21:19:07 UTC (rev 125) @@ -55,24 +55,20 @@ {t}Administrators{/t} <br /> <select name="admins[]" size="8" multiple="multiple"> - {if $notnulladmins.sysUser == 1} <optgroup label="{t}Systemusers{/t}"> {foreach from=$admins item=admin} - {if $admin.mailUser == 0} + {if ! @in_array("mailUser",$admin.objectclass) } <option value="{$admin.dn}">{$admin.uid[0]} ({$admin.cn[0]} {$admin.sn[0]})</option> {/if} {/foreach} </optgroup> - {/if} - {if $notnulladmins.mailUser == 1} <optgroup label="{t}Domainsusers{/t}"> {foreach from=$admins item=admin} - {if $admin.mailUser == 1} + {if @in_array("mailUser",$admin.objectclass) } <option value="{$admin.dn}">{$admin.uid[0]} ({$admin.cn[0]} {$admin.sn[0]})</option> {/if} {/foreach} </optgroup> - {/if} </select> </td> <td> @@ -89,24 +85,20 @@ {t}available users{/t} <br /> <select name="nonadmins[]" size="8" multiple="multiple"> - {if $notnullnonadmins.sysUser == 1} <optgroup label="{t}Systemusers{/t}"> {foreach from=$nonadmins item=nonadmin} - {if $nonadmin.mailUser == 0} + {if ! @in_array("mailUser",$nonadmin.objectclass) } <option value="{$nonadmin.dn}">{$nonadmin.uid[0]} ({$nonadmin.cn[0]} {$nonadmin.sn[0]})</option> {/if} {/foreach} </optgroup> - {/if} - {if $notnullnonadmins.mailUser == 1} <optgroup label="{t}Domainusers{/t}"> {foreach from=$nonadmins item=nonadmin} - {if $nonadmin.mailUser == 1} + {if @in_array("mailUser",$nonadmin.objectclass) } <option value="{$nonadmin.dn}">{$nonadmin.uid[0]} ({$nonadmin.cn[0]} {$nonadmin.sn[0]})</option> {/if} {/foreach} </optgroup> - {/if} </select> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-06 10:49:06
|
Revision: 124 http://elma.svn.sourceforge.net/elma/?rev=124&view=rev Author: tuxevara Date: 2007-07-06 03:49:01 -0700 (Fri, 06 Jul 2007) Log Message: ----------- much cleanup and optimization of code Modified Paths: -------------- trunk/includes/ldap_functions.inc.php trunk/modules/content_systemuser_edit.php trunk/templates/simple/content_systemuser_edit.tpl trunk/templates/simple/js_functions.js Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-05 15:26:15 UTC (rev 123) +++ trunk/includes/ldap_functions.inc.php 2007-07-06 10:49:01 UTC (rev 124) @@ -540,18 +540,15 @@ function getSystemUsersDomains ( $user ) { $userdn = "uid=".$user.",".LDAP_USERS_ROOT_DN; + $search_result = ldap_search($this->cid, LDAP_DOMAINS_ROOT_DN, "(member=$userdn)"); + $domains_dn = ldap_get_entries($this->cid, $search_result); + unset($domains_dn["count"]); - $searchresult = ldap_search($this->cid, LDAP_DOMAINS_ROOT_DN, "(member=$userdn)"); - $searchresult = ldap_get_entries($this->cid, $searchresult); - - unset($searchresult["count"]); - - $tmp = array(); + // extract the domain name from each dn found $domains = array(); - - foreach($searchresult as $dn) { - $tmp = ldap_explode_dn($dn["dn"], 1); - array_push($domains, $tmp[1]); + foreach($domains_dn as $domain_dn) { + $domain = ldap_explode_dn($domain_dn["dn"], 1); + array_push($domains, $domain[1]); } return $domains; Modified: trunk/modules/content_systemuser_edit.php =================================================================== --- trunk/modules/content_systemuser_edit.php 2007-07-05 15:26:15 UTC (rev 123) +++ trunk/modules/content_systemuser_edit.php 2007-07-06 10:49:01 UTC (rev 124) @@ -55,6 +55,9 @@ // new systemuser created or existing systemuser modified if (isset($_POST["submit"])) { + // save all needed information which are no ldap objects themself + $new_adminofdomains = $_POST["nlo_adminofdomains"]; + // remove all non LDAP objects from submited form // an the submit and mode value $my_systemuser = remove_key_by_str($_POST,"nlo_"); @@ -65,12 +68,10 @@ $my_systemuser["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_systemuser["clearpassword"]))); } - if (! defined(SAVECLEARPASS)) { + if (! defined(SAVECLEARPASS) || empty($my_systemuser["clearpassword"])) { unset($my_systemuser["clearpassword"]); } - unset($my_systemuser["clearpassword"]); - $validation_errors = validate_systemuser($my_systemuser); if (count($validation_errors) == 0) { switch ($_POST["mode"]) { @@ -78,30 +79,9 @@ $this->ldap->addSystemUser($my_systemuser); break; case "modify": - unset ($my_systemuser["domains"]); - $domainsin = $this->ldap->getSystemUsersDomains($systemuser); - -my_print_r($domainsin); - - /* filter the values out of the dc */ - $tmpdomainsin = $domainsin; - - $domainsin = array(); - - $tmp = null; - - foreach($tmpdomainsin as $domainin) { - my_print_r(ldap_explode_dn($domainin,1)); - array_push($domainsin, $tmp[1]); - } - - if (isset($my_systemuser["domainsin"])) { - $tmpdomainsin = $my_systemuser["domainsin"]; - unset($my_systemuser["domainsin"]); - } else { - $tmpdomainsin = array(); - } - + $old_adminofdomains = $this->ldap->getSystemUsersDomains($systemuser); + unset ($my_systemuser["adminofdomains"]); + $this->ldap->modSystemUser($my_systemuser); $addDomainAdmin = array(); @@ -110,35 +90,12 @@ /* check if the user is admin already */ /* and put him onto the add array if not */ - foreach($tmpdomainsin as $tmpdomainin) { - $isinarray = 0; - foreach($domainsin as $domainin) { - if ($domainin == $tmpdomainin) { - $isinarray = 1; - break; - } - } - - if ($isinarray == 0) { - array_push($addDomainAdmin, $tmpdomainin); - } - } + $addDomainAdmin = array_diff($new_adminofdomains,$old_adminofdomains); + /* check if the user used to be admin */ /* and put him onto the del array if he isn't any longer */ - foreach($domainsin as $domainin) { - $isinarray = 0; - foreach($tmpdomainsin as $tmpdomainin) { - if ($tmpdomainin == $domainin) { - $isinarray = 1; - break; - } - } + $delDomainAdmin = array_diff($old_adminofdomains,$new_adminofdomains); - if ($isinarray == 0) { - array_push($delDomainAdmin, $domainin); - } - } - if (isset($addDomainAdmin)) { foreach($addDomainAdmin as $domain) { $this->ldap->addAdminUsers($domain, "uid=".$systemuser.",".LDAP_USERS_ROOT_DN); @@ -168,63 +125,29 @@ $this->smarty->assign("submit_status",-1); } - $domainsin = $this->ldap->getSystemUsersDomains($systemuser); - $tmpdomains = $this->ldap->listDomains(); + $adminofdomains = $this->ldap->getSystemUsersDomains($systemuser); + $domains_dn = $this->ldap->listDomains(); /* check in which domains the selected user is */ if ($_SESSION["userclass"] == "systemadmin" ) { /* filter the dc part out of the dn */ - unset($tmpdomains["count"]); + unset($domains_dn["count"]); - $tmp = array(); + $domain = array(); $domains = array(); - foreach($tmpdomains as $domain) { - $tmp = ldap_explode_dn($domain["dn"], 0); - array_push($domains, $tmp[0]); + foreach($domains_dn as $domain_dn) { + $domain = ldap_explode_dn($domain_dn["dn"], 1); + array_push($domains, $domain[0]); } - /* filter the values out of the dc */ - $tmpdomains = $domains; - $tmpdomainsin = $domainsin; - - $domains = array(); - $domainsin = array(); - - $tmp = null; - - foreach($tmpdomains as $domain) { - $tmp = explode("=", $domain); - array_push($domains, $tmp[1]); - } - - foreach($tmpdomainsin as $domain) { - $tmp = explode("=", $domain); - array_push($domainsin, $tmp[1]); - } - /* we want to have only the domains in $domains which aren't in $domainsin already */ - $tmpdomains = $domains; - $domains = array(); + $available_domains = array(); + $available_domains = array_diff($domains,$adminofdomains); - foreach($tmpdomains as $domain) { - $isin = 0; - - foreach($domainsin as $domainin) { - if ($domainin == $domain) { - $isin = 1; - break; - } - } - - if ($isin == 0) { - array_push($domains, $domain); - } - } - /* assign domain vars only if the logged in user is an admin */ - $this->smarty->assign("domains", $domains); - $this->smarty->assign("domainsin", $domainsin); + $this->smarty->assign("availabledomains", $available_domains); + $this->smarty->assign("adminofdomains", $adminofdomains); } if ( $systemuser == "new" ) { Modified: trunk/templates/simple/content_systemuser_edit.tpl =================================================================== --- trunk/templates/simple/content_systemuser_edit.tpl 2007-07-05 15:26:15 UTC (rev 123) +++ trunk/templates/simple/content_systemuser_edit.tpl 2007-07-06 10:49:01 UTC (rev 124) @@ -76,8 +76,8 @@ <td> {t}Administrator of{/t} <br /> - <select name="domainsin[]" size="8" multiple="multiple"> - {foreach from=$domains item=domain} + <select name="nlo_adminofdomains[]" size="8" multiple="multiple"> + {foreach from=$adminofdomains item=domain} <option value="{$domain}">{$domain}</option> {/foreach} </select> @@ -95,8 +95,8 @@ <td> {t}Not administrator of{/t} <br /> - <select name="domains[]" size="8" multiple="multiple"> - {foreach from=$domains item=domain} + <select name="nlo_availabledomains[]" size="8" multiple="multiple"> + {foreach from=$availabledomains item=domain} <option value="{$domain}">{$domain}</option> {/foreach} </select> Modified: trunk/templates/simple/js_functions.js =================================================================== --- trunk/templates/simple/js_functions.js 2007-07-05 15:26:15 UTC (rev 123) +++ trunk/templates/simple/js_functions.js 2007-07-06 10:49:01 UTC (rev 124) @@ -33,39 +33,39 @@ } } -// marks all list entries in element "domainsin[]" +// marks all list entries in element "adminofdomains[]" function markAllDomains() { - var domainsin = document.getElementsByName("domainsin[]"); + var nlo_adminofdomains = document.getElementsByName("nlo_adminofdomains[]"); - for (i=0; i < domainsin[0].options.length; i++) { - domainsin[0].options[i].selected = true; + for (i=0; i < nlo_adminofdomains[0].options.length; i++) { + nlo_adminofdomains[0].options[i].selected = true; } } -// moves a domain from the "domainsin[]" element to the "domains[]" element +// moves a domain from the "adminofdomains[]" element to the "domains[]" element // this means that the domain is removed from the user's list of administrated // domains function delDomain() { - var domainsin = document.getElementsByName("domainsin[]"); - var domains = document.getElementsByName("domains[]"); + var nlo_adminofdomains = document.getElementsByName("nlo_adminofdomains[]"); + var nlo_availabledomains = document.getElementsByName("nlo_availabledomains[]"); - for (i=0; i < domainsin[0].options.length; i++) { - if (domainsin[0].options[i].selected == true) { - domains[0].appendChild(domainsin[0].options[i]); + for (i=0; i < nlo_adminofdomains[0].options.length; i++) { + if (nlo_adminofdomains[0].options[i].selected == true) { + nlo_availabledomains[0].appendChild(nlo_adminofdomains[0].options[i]); } } } -// moves a domain from the "domains[]" element to the "domainsin[]" element +// moves a domain from the "domains[]" element to the "adminofdomains[]" element // this means that the domain is added to the user's list of administrated // domains function addDomain() { - var domainsin = document.getElementsByName("domainsin[]"); - var domains = document.getElementsByName("domains[]"); + var nlo_adminofdomains = document.getElementsByName("nlo_adminofdomains[]"); + var nlo_availabledomains = document.getElementsByName("nlo_availabledomains[]"); - for (i=0; i < domains[0].options.length; i++) { - if (domains[0].options[i].selected == true) { - domainsin[0].appendChild(domains[0].options[i]); + for (i=0; i < nlo_availabledomains[0].options.length; i++) { + if (nlo_availabledomains[0].options[i].selected == true) { + nlo_adminofdomains[0].appendChild(nlo_availabledomains[0].options[i]); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-05 15:26:23
|
Revision: 123 http://elma.svn.sourceforge.net/elma/?rev=123&view=rev Author: tuxevara Date: 2007-07-05 08:26:15 -0700 (Thu, 05 Jul 2007) Log Message: ----------- makeing things more simple Modified Paths: -------------- trunk/includes/acl.inc.php trunk/includes/ldap_functions.inc.php trunk/index.php trunk/modules/content_domain_edit.php trunk/modules/content_systemuser_edit.php trunk/templates/simple/content_domain_edit.tpl trunk/templates/simple/content_main.tpl trunk/templates/simple/content_settings.tpl trunk/templates/simple/content_systemuser_edit.tpl trunk/templates/simple/navigation.tpl Modified: trunk/includes/acl.inc.php =================================================================== --- trunk/includes/acl.inc.php 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/includes/acl.inc.php 2007-07-05 15:26:15 UTC (rev 123) @@ -2,8 +2,8 @@ // ACLs define ("ACL",serialize(array( - "systemadmin" => array("main","domains_list","domain_edit","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit"), - "domainadmin" => array("main","domains_list","domain_edit","users_list","user_edit","user_delete","alias_edit","alias_delete"), + "systemadmin" => array("main","domains_list","domain_edit","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit","statistics"), + "domainadmin" => array("main","domains_list","domain_edit","users_list","user_edit","user_delete","alias_edit","alias_delete","statistics"), "user" => array("main") ))); Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/includes/ldap_functions.inc.php 2007-07-05 15:26:15 UTC (rev 123) @@ -550,7 +550,7 @@ $domains = array(); foreach($searchresult as $dn) { - $tmp = ldap_explode_dn($dn["dn"], 0); + $tmp = ldap_explode_dn($dn["dn"], 1); array_push($domains, $tmp[1]); } Modified: trunk/index.php =================================================================== --- trunk/index.php 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/index.php 2007-07-05 15:26:15 UTC (rev 123) @@ -65,8 +65,6 @@ $smarty->assign('userclass',$_SESSION['userclass']); $smarty->assign('acl',$acl[$_SESSION['userclass']]); - my_print_r($acl[$_SESSION['userclass']]); - $content = $content_module->getContent(); } else { $content = "no access"; Modified: trunk/modules/content_domain_edit.php =================================================================== --- trunk/modules/content_domain_edit.php 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/modules/content_domain_edit.php 2007-07-05 15:26:15 UTC (rev 123) @@ -158,6 +158,8 @@ if ($domain == "new") { $this->smarty->assign("mode","add"); + $this->smarty->assign("domain",array()); + $users = $this->ldap->listSystemUsers(); if (isset($users)) { Modified: trunk/modules/content_systemuser_edit.php =================================================================== --- trunk/modules/content_systemuser_edit.php 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/modules/content_systemuser_edit.php 2007-07-05 15:26:15 UTC (rev 123) @@ -80,7 +80,9 @@ case "modify": unset ($my_systemuser["domains"]); $domainsin = $this->ldap->getSystemUsersDomains($systemuser); - + +my_print_r($domainsin); + /* filter the values out of the dc */ $tmpdomainsin = $domainsin; @@ -89,7 +91,7 @@ $tmp = null; foreach($tmpdomainsin as $domainin) { - $tmp = explode("=", $domainin); + my_print_r(ldap_explode_dn($domainin,1)); array_push($domainsin, $tmp[1]); } @@ -166,68 +168,69 @@ $this->smarty->assign("submit_status",-1); } - if ( $systemuser == "new" ) { - $this->smarty->assign("mode","add"); - } else { - $domainsin = $this->ldap->getSystemUsersDomains($systemuser); - $tmpdomains = $this->ldap->listDomains(); + $domainsin = $this->ldap->getSystemUsersDomains($systemuser); + $tmpdomains = $this->ldap->listDomains(); - /* check in which domains the selected user is */ - if ($_SESSION["userclass"] == "systemadmin" ) { - /* filter the dc part out of the dn */ - unset($tmpdomains["count"]); + /* check in which domains the selected user is */ + if ($_SESSION["userclass"] == "systemadmin" ) { + /* filter the dc part out of the dn */ + unset($tmpdomains["count"]); - $tmp = array(); - $domains = array(); + $tmp = array(); + $domains = array(); - foreach($tmpdomains as $domain) { - $tmp = ldap_explode_dn($domain["dn"], 0); - array_push($domains, $tmp[0]); - } + foreach($tmpdomains as $domain) { + $tmp = ldap_explode_dn($domain["dn"], 0); + array_push($domains, $tmp[0]); + } - /* filter the values out of the dc */ - $tmpdomains = $domains; - $tmpdomainsin = $domainsin; + /* filter the values out of the dc */ + $tmpdomains = $domains; + $tmpdomainsin = $domainsin; - $domains = array(); - $domainsin = array(); + $domains = array(); + $domainsin = array(); + + $tmp = null; - $tmp = null; + foreach($tmpdomains as $domain) { + $tmp = explode("=", $domain); + array_push($domains, $tmp[1]); + } - foreach($tmpdomains as $domain) { - $tmp = explode("=", $domain); - array_push($domains, $tmp[1]); - } + foreach($tmpdomainsin as $domain) { + $tmp = explode("=", $domain); + array_push($domainsin, $tmp[1]); + } - foreach($tmpdomainsin as $domain) { - $tmp = explode("=", $domain); - array_push($domainsin, $tmp[1]); - } + /* we want to have only the domains in $domains which aren't in $domainsin already */ + $tmpdomains = $domains; + $domains = array(); - /* we want to have only the domains in $domains which aren't in $domainsin already */ - $tmpdomains = $domains; - $domains = array(); + foreach($tmpdomains as $domain) { + $isin = 0; - foreach($tmpdomains as $domain) { - $isin = 0; - - foreach($domainsin as $domainin) { - if ($domainin == $domain) { - $isin = 1; - break; - } + foreach($domainsin as $domainin) { + if ($domainin == $domain) { + $isin = 1; + break; } + } - if ($isin == 0) { - array_push($domains, $domain); - } + if ($isin == 0) { + array_push($domains, $domain); } - - /* assign domain vars only if the logged in user is an admin */ - $this->smarty->assign("domains", $domains); - $this->smarty->assign("domainsin", $domainsin); } + /* assign domain vars only if the logged in user is an admin */ + $this->smarty->assign("domains", $domains); + $this->smarty->assign("domainsin", $domainsin); + } + + if ( $systemuser == "new" ) { + $this->smarty->assign("mode","add"); + + } else { $this->smarty->assign("mode","modify"); $this->smarty->assign("user",$this->ldap->getSystemUser($systemuser)); } Modified: trunk/templates/simple/content_domain_edit.tpl =================================================================== --- trunk/templates/simple/content_domain_edit.tpl 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/templates/simple/content_domain_edit.tpl 2007-07-05 15:26:15 UTC (rev 123) @@ -36,7 +36,7 @@ {t}Is active?{/t} </td> <td> - <input type="checkbox" name="mailstatus" {if $domain.mailstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> + <input type="checkbox" name="mailstatus" {if $domain.mailstatus.0 eq "TRUE"}checked="checked"{/if} /> </td> </tr> <tr> Modified: trunk/templates/simple/content_main.tpl =================================================================== --- trunk/templates/simple/content_main.tpl 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/templates/simple/content_main.tpl 2007-07-05 15:26:15 UTC (rev 123) @@ -1,7 +1,7 @@ <div id="Content"> <h2>{t}Welcome to your Exim LDAP Mail Administrator Frontend{/t}</h2> <p>{t}Click on the Domains link at the left navigation bar to get an overview of your email domains. When you click on the domain name you will see all users and aliases for that domain. Everything else should be pretty self explaining. Have fun ;-){/t}</p> - {if $userclass != "user"} + {if @in_array("statistics",$acl) } <h3>{t}Statistics{/t}</h3> <table> <tr><td>{t}Domains{/t}</td><td>{$domainCount} ({$domainCountActive} {t}active{/t})</td></tr> Modified: trunk/templates/simple/content_settings.tpl =================================================================== --- trunk/templates/simple/content_settings.tpl 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/templates/simple/content_settings.tpl 2007-07-05 15:26:15 UTC (rev 123) @@ -3,6 +3,8 @@ {if @in_array("systemusers_list",$acl) } <p><a href="{$smarty.server.PHP_SELF}?module=systemusers_list">{t}Users{/t}</a> - {t}Manage systemwide users. This gives you the ability to create users for your staff or customers, who should have access to certain domains only.{/t}</p> {/if} + {if @in_array("globaladmins_edit",$acl) } <p><a href="{$smarty.server.PHP_SELF}?module=globaladmins_edit">{t}Administrators{/t}</a> - {t}Define which systemwide users should have global adminstrative rights. Theese can create new systemwide users as well as new domains.{/t}</p> + {/if} </div> Modified: trunk/templates/simple/content_systemuser_edit.tpl =================================================================== --- trunk/templates/simple/content_systemuser_edit.tpl 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/templates/simple/content_systemuser_edit.tpl 2007-07-05 15:26:15 UTC (rev 123) @@ -61,7 +61,6 @@ {t}(leave empty to keep password){/t} </td> </tr> - {if $userclass == "systemadmin"} <tr> <td colspan="2"> <hr/> @@ -78,7 +77,7 @@ {t}Administrator of{/t} <br /> <select name="domainsin[]" size="8" multiple="multiple"> - {foreach from=$domainsin item=domain} + {foreach from=$domains item=domain} <option value="{$domain}">{$domain}</option> {/foreach} </select> @@ -106,7 +105,6 @@ </table> </td> </tr> - {/if} <tr> <td colspan="2"> <hr/> Modified: trunk/templates/simple/navigation.tpl =================================================================== --- trunk/templates/simple/navigation.tpl 2007-07-05 09:59:43 UTC (rev 122) +++ trunk/templates/simple/navigation.tpl 2007-07-05 15:26:15 UTC (rev 123) @@ -1,10 +1,10 @@ <div id="Navigation"> <ul> <li><a href="{$smarty.server.PHP_SELF}?module=main">{t}Home{/t}</a></li> - {if $userclass != "user"} + {if @in_array("domains_list",$acl) } <li><a href="{$smarty.server.PHP_SELF}?module=domains_list">{t}Domains{/t}</a></li> {/if} - {if $userclass == "systemadmin"} + {if @in_array("settings",$acl) } <li><a href="{$smarty.server.PHP_SELF}?module=settings">{t}Settings{/t}</a></li> {/if} <li><a href="logout.php">{t}Logout{/t}</a></li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-07-05 09:59:45
|
Revision: 122 http://elma.svn.sourceforge.net/elma/?rev=122&view=rev Author: tuxevara Date: 2007-07-05 02:59:43 -0700 (Thu, 05 Jul 2007) Log Message: ----------- acl functions extended Modified Paths: -------------- trunk/index.php trunk/modules/content_globaladmins_edit.php trunk/modules/content_systemuser_edit.php trunk/templates/simple/content_settings.tpl trunk/templates/simple/content_systemuser_edit.tpl Added Paths: ----------- trunk/includes/acl.inc.php Added: trunk/includes/acl.inc.php =================================================================== --- trunk/includes/acl.inc.php (rev 0) +++ trunk/includes/acl.inc.php 2007-07-05 09:59:43 UTC (rev 122) @@ -0,0 +1,10 @@ +<?php + +// ACLs +define ("ACL",serialize(array( + "systemadmin" => array("main","domains_list","domain_edit","domain_delete","users_list","user_edit","user_delete","alias_edit","alias_delete","settings","systemusers_list","systemuser_edit","systemuser_delete","globaladmins_edit"), + "domainadmin" => array("main","domains_list","domain_edit","users_list","user_edit","user_delete","alias_edit","alias_delete"), + "user" => array("main") + ))); + +?> Modified: trunk/index.php =================================================================== --- trunk/index.php 2007-06-28 07:09:42 UTC (rev 121) +++ trunk/index.php 2007-07-05 09:59:43 UTC (rev 122) @@ -31,7 +31,8 @@ session_start(); require("includes/config.inc.php"); -include("includes/smarty.inc.php"); +require("includes/acl.inc.php"); +require("includes/smarty.inc.php"); require("includes/gettext.inc.php"); require("includes/ldap_functions.inc.php"); require("includes/my_functions.inc.php"); @@ -41,7 +42,7 @@ $module = $_POST["module"]; else if (isset($_GET["module"])) $module = $_GET["module"]; -else $module = ""; +else $module = "main"; if (!isset($_SESSION["login"])) { session_destroy(); @@ -50,17 +51,27 @@ $smarty->display("login.tpl"); $smarty->display("footer.tpl"); } else { - require('modules/modules.class.php'); - $content_module = &modules::factory($module); - $smarty->assign('username',$_SESSION['username']); - $smarty->assign('userclass',$_SESSION['userclass']); + $acl = unserialize(ACL); - $content_module->smarty = $smarty; - $content_module->proceed(); + // check if the userclass has access to the module + if ( in_array($module,$acl[$_SESSION['userclass']]) ) { + require('modules/modules.class.php'); + $content_module = &modules::factory($module); + $content_module->smarty = $smarty; + $content_module->proceed(); + + $smarty->assign('username',$_SESSION['username']); + $smarty->assign('userclass',$_SESSION['userclass']); + $smarty->assign('acl',$acl[$_SESSION['userclass']]); - $content = $content_module->getContent(); + my_print_r($acl[$_SESSION['userclass']]); + $content = $content_module->getContent(); + } else { + $content = "no access"; + } + $smarty->display("header.tpl"); $smarty->display("banner.tpl"); $smarty->display("navigation.tpl"); Modified: trunk/modules/content_globaladmins_edit.php =================================================================== --- trunk/modules/content_globaladmins_edit.php 2007-06-28 07:09:42 UTC (rev 121) +++ trunk/modules/content_globaladmins_edit.php 2007-07-05 09:59:43 UTC (rev 122) @@ -28,10 +28,10 @@ */ /** - * content domain edit + * content globaladmins edit * - * This content module is used for creating the domain edit form and - * handling the submited data. + * This content module is used for adding systemusers to the global admingroup. + * */ class content_globaladmins_edit extends module_base @@ -72,53 +72,55 @@ $count = 0; - if (isset($ldapadmins[0])) { - if (isset($admins)) { - - /* create array of new admins */ - foreach ($admins as $admin) { - $isinarray = 0; - for ($c=0; $c < $ldapadmins[0]["member"]["count"]; $c++) { - if ($admin == $ldapadmins[0]["member"][$c]){ - $isinarray = 1; - break; - } + /* create array of new admins */ + if (isset($admins)) { + foreach ($admins as $admin) { + $isinarray = 0; + for ($c=0; $c < $ldapadmins[0]["member"]["count"]; $c++) { + if ($admin == $ldapadmins[0]["member"][$c]){ + $isinarray = 1; + break; } + } - if ($isinarray == 0) { - $adminsadd[$count] = $admin; - $count++; - } + if ($isinarray == 0) { + $adminsadd[$count] = $admin; + $count++; } + } - $count = 0; + $count = 0; + } - - /* create array of removed admins */ - for ($i=0; $i < $ldapadmins[0]["member"]["count"]; $i++) { - $isinarray = 0; - foreach ($admins as $admin) { - if ($ldapadmins[0]["member"][$i] == $admin) { - $isinarray = 1; - break; - } + /* create array of removed admins */ + for ($i=0; $i < $ldapadmins[0]["member"]["count"]; $i++) { + $isinarray = 0; + + if (isset($admins)) { + foreach ($admins as $admin) { + if ($ldapadmins[0]["member"][$i] == $admin) { + $isinarray = 1; + break; } - - if ($isinarray == 0) { - $adminsdel[$count] = $ldapadmins[0]["member"][$i]; - $count++; - } } } - if (isset($adminsadd)) { - $this->ldap->addAdminUsers(null, $adminsadd); + if ($isinarray == 0) { + $adminsdel[$count] = $ldapadmins[0]["member"][$i]; + $count++; } - if (isset($adminsdel)) { - $this->ldap->delAdminUsers(null, $adminsdel); - } } + /* add admins to ldap if neccesary */ + if (isset($adminsadd)) { + $this->ldap->addAdminUsers(null, $adminsadd); + } + + /* delete admins from ldap if neccesary */ + if (isset($adminsdel)) { + $this->ldap->delAdminUsers(null, $adminsdel); + } + $submit_status = ldap_errno($this->ldap->cid); if ($submit_status == "0") { $this->smarty->assign("submit_status",$submit_status); Modified: trunk/modules/content_systemuser_edit.php =================================================================== --- trunk/modules/content_systemuser_edit.php 2007-06-28 07:09:42 UTC (rev 121) +++ trunk/modules/content_systemuser_edit.php 2007-07-05 09:59:43 UTC (rev 122) @@ -173,7 +173,7 @@ $tmpdomains = $this->ldap->listDomains(); /* check in which domains the selected user is */ - if ($_SESSION["userclass"] == "admin" ) { + if ($_SESSION["userclass"] == "systemadmin" ) { /* filter the dc part out of the dn */ unset($tmpdomains["count"]); @@ -230,7 +230,6 @@ $this->smarty->assign("mode","modify"); $this->smarty->assign("user",$this->ldap->getSystemUser($systemuser)); - $this->smarty->assign("isadmin",$isadmin); } } Modified: trunk/templates/simple/content_settings.tpl =================================================================== --- trunk/templates/simple/content_settings.tpl 2007-06-28 07:09:42 UTC (rev 121) +++ trunk/templates/simple/content_settings.tpl 2007-07-05 09:59:43 UTC (rev 122) @@ -1,8 +1,8 @@ <div id="Content"> <h2>{t}Settings{/t}</h2> - {if $userclass == "systemadmin"} + {if @in_array("systemusers_list",$acl) } <p><a href="{$smarty.server.PHP_SELF}?module=systemusers_list">{t}Users{/t}</a> - {t}Manage systemwide users. This gives you the ability to create users for your staff or customers, who should have access to certain domains only.{/t}</p> + {/if} <p><a href="{$smarty.server.PHP_SELF}?module=globaladmins_edit">{t}Administrators{/t}</a> - {t}Define which systemwide users should have global adminstrative rights. Theese can create new systemwide users as well as new domains.{/t}</p> - {/if} </div> Modified: trunk/templates/simple/content_systemuser_edit.tpl =================================================================== --- trunk/templates/simple/content_systemuser_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) +++ trunk/templates/simple/content_systemuser_edit.tpl 2007-07-05 09:59:43 UTC (rev 122) @@ -61,7 +61,7 @@ {t}(leave empty to keep password){/t} </td> </tr> - {if $isadmin == true} + {if $userclass == "systemadmin"} <tr> <td colspan="2"> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tux...@us...> - 2007-06-28 07:09:44
|
Revision: 121 http://elma.svn.sourceforge.net/elma/?rev=121&view=rev Author: tuxevara Date: 2007-06-28 00:09:42 -0700 (Thu, 28 Jun 2007) Log Message: ----------- some style work tried to reduce the number of used varables Modified Paths: -------------- trunk/login.php trunk/modules/content_systemuser_edit.php trunk/templates/simple/content_alias_edit.tpl trunk/templates/simple/content_domain_edit.tpl trunk/templates/simple/content_globaladmins_edit.tpl trunk/templates/simple/content_systemuser_edit.tpl trunk/templates/simple/content_user_edit.tpl trunk/templates/simple/style.css Modified: trunk/login.php =================================================================== --- trunk/login.php 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/login.php 2007-06-28 07:09:42 UTC (rev 121) @@ -58,22 +58,16 @@ $_SESSION["username"] = $_POST["username"]; $_SESSION["language"] = $_POST["language"]; - $systemuser = $ldap->listSystemUsers(); - $adminuser = $ldap->isAdminUser($_SESSION["username"]); - $domaincount = $ldap->domainCount(); - - if ($adminuser == true) { - $userclass = "systemadmin"; + if ( $ldap->isAdminUser($_SESSION["username"]) ) { + $_SESSION["userclass"] = "systemadmin"; } else { - if ($domaincount == 0) { - $userclass = "user"; + if ( $ldap->domainCount() == 0) { + $_SESSION["userclass"] = "user"; } else { - $userclass = "domainadmin"; + $_SESSION["userclass"] = "domainadmin"; } } - $_SESSION["userclass"] = $userclass; - $crypt = new mycrypt(); $_SESSION["ldap_binddn"] = $crypt->encrypt($LDAP_BINDDN); $_SESSION["ldap_bindpass"] = $crypt->encrypt($LDAP_BINDPASS); Modified: trunk/modules/content_systemuser_edit.php =================================================================== --- trunk/modules/content_systemuser_edit.php 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/modules/content_systemuser_edit.php 2007-06-28 07:09:42 UTC (rev 121) @@ -169,12 +169,11 @@ if ( $systemuser == "new" ) { $this->smarty->assign("mode","add"); } else { - $isadmin = $this->ldap->isAdminUser($_SESSION["username"]); $domainsin = $this->ldap->getSystemUsersDomains($systemuser); $tmpdomains = $this->ldap->listDomains(); /* check in which domains the selected user is */ - if ($isadmin) { + if ($_SESSION["userclass"] == "admin" ) { /* filter the dc part out of the dn */ unset($tmpdomains["count"]); @@ -223,10 +222,8 @@ array_push($domains, $domain); } } - } - /* assign domain vars only if the logged in user is an admin */ - if ($isadmin) { + /* assign domain vars only if the logged in user is an admin */ $this->smarty->assign("domains", $domains); $this->smarty->assign("domainsin", $domainsin); } Modified: trunk/templates/simple/content_alias_edit.tpl =================================================================== --- trunk/templates/simple/content_alias_edit.tpl 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/content_alias_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) @@ -54,9 +54,13 @@ <input type="checkbox" name="mailstatus" {if $alias.mailstatus.0 eq "FALSE"}{else}checked="checked"{/if} /> </td> </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> <tr> - <td> </td> - <td> + <td colspan="2" class="buttons"> <input type="submit" name="submit" value="{t}Save{/t}"/> </td> </tr> Modified: trunk/templates/simple/content_domain_edit.tpl =================================================================== --- trunk/templates/simple/content_domain_edit.tpl 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/content_domain_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) @@ -113,6 +113,11 @@ </table> </td> </tr> + <tr> + <td colspan="2"> + <hr /> + </td> + </tr> <tr> <td colspan="2" class="buttons"><input type="submit" name="submit" value="{t}Save{/t}" /></td> </tr> Modified: trunk/templates/simple/content_globaladmins_edit.tpl =================================================================== --- trunk/templates/simple/content_globaladmins_edit.tpl 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/content_globaladmins_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) @@ -29,7 +29,7 @@ </div> </td> <td> - {t}available users{/t} + {t}Users{/t} <br /> <select name="nonadmins[]" size="8" multiple="multiple"> {foreach from=$nonadmins item=nonadmin} @@ -42,6 +42,11 @@ </td> </tr> <tr> + <td colspan="2"> + <hr/> + </td> + </tr> + <tr> <td class="buttons"> <input type="submit" name="submit" value="{t}Save{/t}" /> </td> Modified: trunk/templates/simple/content_systemuser_edit.tpl =================================================================== --- trunk/templates/simple/content_systemuser_edit.tpl 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/content_systemuser_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) @@ -107,6 +107,11 @@ </td> </tr> {/if} + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> <tr> <td colspan="2" class="buttons"> <input type="submit" name="submit" value="{t}Save{/t}"/> Modified: trunk/templates/simple/content_user_edit.tpl =================================================================== --- trunk/templates/simple/content_user_edit.tpl 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/content_user_edit.tpl 2007-06-28 07:09:42 UTC (rev 121) @@ -69,6 +69,11 @@ <input type="text" name="clearpassword" value="{$user.clearpassword.0}" /> </td> </tr> + <tr> + <td colspan="2"> + <hr/> + </td> + </tr> <tr> <td colspan="2" class="buttons"> <input type="submit" name="submit" value="{t}Save{/t}" id="button"/> Modified: trunk/templates/simple/style.css =================================================================== --- trunk/templates/simple/style.css 2007-06-26 11:35:31 UTC (rev 120) +++ trunk/templates/simple/style.css 2007-06-28 07:09:42 UTC (rev 121) @@ -218,9 +218,7 @@ height: 25px; } -td.buttons { - border-top: 1px #99CCFF solid; - background-color: #77AADD; +div#Content td.buttons { text-align: right; vertical-align: middle; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ad...@us...> - 2007-06-26 11:35:34
|
Revision: 120 http://elma.svn.sourceforge.net/elma/?rev=120&view=rev Author: adan0s Date: 2007-06-26 04:35:31 -0700 (Tue, 26 Jun 2007) Log Message: ----------- - fixed some small issues Modified Paths: -------------- trunk/modules/content_domain_edit.php trunk/modules/content_user_edit.php Modified: trunk/modules/content_domain_edit.php =================================================================== --- trunk/modules/content_domain_edit.php 2007-06-26 08:06:47 UTC (rev 119) +++ trunk/modules/content_domain_edit.php 2007-06-26 11:35:31 UTC (rev 120) @@ -162,7 +162,19 @@ if (isset($users)) { unset($users["count"]); - $this->smarty->assign("nonadmins",$users); + + $tmpusers = $users; + $users = array(); + + foreach ($tmpusers as $user) { + $user["mailUser"] = 0; + array_push($users, $user); + } + + $tmp["sysUser"] = 1; + + $this->smarty->assign("nonadmins", $users); + $this->smarty->assign("notnullnonadmins", $tmp); } } else { $this->smarty->assign("mode","modify"); @@ -222,6 +234,7 @@ array_push($users, $user); } } + } else { } if (isset($admins)) { @@ -233,7 +246,7 @@ if (isset($users)) { $this->smarty->assign("nonadmins", $users); - if (isset($notnulladmins)) { + if (isset($notnullusers)) { $this->smarty->assign("notnullnonadmins", $notnullusers); } } Modified: trunk/modules/content_user_edit.php =================================================================== --- trunk/modules/content_user_edit.php 2007-06-26 08:06:47 UTC (rev 119) +++ trunk/modules/content_user_edit.php 2007-06-26 11:35:31 UTC (rev 120) @@ -68,10 +68,7 @@ $my_user["mailstatus"] = "FALSE"; } - if (! $my_user["clearpassword"] == "") { - $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); - unset($my_user["clearpassword"]); - } + $my_user["userpassword"] = "{MD5}".base64_encode(pack("H*",md5($my_user["clearpassword"]))); $validation_errors = validate_user($my_user); if (count($validation_errors) == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ad...@us...> - 2007-06-26 08:06:48
|
Revision: 119 http://elma.svn.sourceforge.net/elma/?rev=119&view=rev Author: adan0s Date: 2007-06-26 01:06:47 -0700 (Tue, 26 Jun 2007) Log Message: ----------- - added comments to all functions Modified Paths: -------------- trunk/includes/ldap_functions.inc.php Modified: trunk/includes/ldap_functions.inc.php =================================================================== --- trunk/includes/ldap_functions.inc.php 2007-06-26 07:43:02 UTC (rev 118) +++ trunk/includes/ldap_functions.inc.php 2007-06-26 08:06:47 UTC (rev 119) @@ -98,11 +98,26 @@ # DOMAIN + /** + * listDomains - listing domains + * + * This function lists any domain + */ function listDomains () { $domains = $this->getDomain("*"); return $domains; } + /** + * getDomain - gets information about domain(s) + * + * This function get information about domain(s) inside the ldap-tree + * + * when active is "TRUE" only active domains will be listed + * + * @domain_dc string dc= value of a domain's DN + * @active string "*" for listing any, "TRUE" for listing active domains only + */ function getDomain ($domain_dc = "*", $active="*") { $result = ldap_list($this->cid, LDAP_DOMAINS_ROOT_DN, "(&(mailStatus=$active)(dc=$domain_dc))"); $domain = ldap_get_entries($this->cid, $result); @@ -111,7 +126,16 @@ } return $domain; } - + + /** + * addDomain - adds a domain + * + * This functions adds a domain and an admingroup + * the main-admin is included in this admingroup by default + * + * @domain array information about the domain + * @admins array admin dns + */ function addDomain ( $domain , $admins ) { $domain["objectclass"] = "mailDomain"; ldap_add($this->cid, "dc=".$domain['dc'].",".LDAP_DOMAINS_ROOT_DN, $domain); @@ -131,6 +155,13 @@ return $result; } + /** + * modifyDomain - modifying a domain's information + * + * This function modifies a domain's information + * + * @domain array information about the domain + */ function modifyDomain ( $domain ) { ldap_modify($this->cid,"dc=".$domain["dc"].",".LDAP_DOMAINS_ROOT_DN, $domain); if ( ldap_errno($this->cid) !== 0 ) { @@ -141,6 +172,13 @@ return $result; } + /** + * deleteDomain - deleting a Domain + * + * This function deletes a domain + * + * @domain string dc= value of a domain's DN + */ function deleteDomain ( $domain ) { my_ldap_delete($this->cid,"dc=$domain,".LDAP_DOMAINS_ROOT_DN,true); if ( ldap_errno($this->cid) !== 0 ) { @@ -154,11 +192,27 @@ # USER + /** + * listUsers - listing any user in a domain + * + * This function lists any user in the specified domain + * + * @domain string dc= value of a domain's DN + */ function listUsers( $domain ) { $users = $this->getUser( $domain ); return $users; } + /** + * getUser - getting information about a user + * + * This function gets information about a specific user + * + * @domain string dc= value of a domain's DN where the user is in + * @user_uid string uid= value of the user's DN + * @active string "*" shows any user, "TRUE" shows active users only + */ function getUser ( $domain, $user_uid = "*", $active = "*") { if ($active == "*") { $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailUser)(uid=$user_uid))"); @@ -170,6 +224,14 @@ return $user; } + /** + * addUser - adding a user + * + * This function adds a user to the ldap-tree + * + * @domain string dc= value of the domain the user should belong to + * @user array information about the user + */ function addUser ( $domain, $user) { $user["objectclass"] = "mailUser"; ldap_add($this->cid, "uid=".$user['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $user); @@ -181,6 +243,14 @@ return $result; } + /** + * modifyUser - modifying a user + * + * This function modifies the information of a user + * + * @domain string dc= value of the domain the user is in + * @user array information about the user + */ function modifyUser ( $domain, $user) { ldap_modify($this->cid, "uid=".$user['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $user); if ( ldap_errno($this->cid) !== 0 ) { @@ -191,6 +261,15 @@ return $result; } + /** + * deleteUser - deleting a user + * + * This function removes a user from the ldap-tree + * (including his presence in any admingroup) + * + * @domain string dc= value of the domain the user is in + * @user string uid= value of the users DN + */ function deleteUser ( $domain, $user) { $searchresult = ldap_search($this->cid, LDAP_BASEDN, "(&(member=*)(cn=admingroup))"); $searchresult = ldap_get_entries($this->cid, $searchresult); @@ -232,11 +311,27 @@ # ALIAS + /** + * listAliases - listing all aliases in a domain + * + * This function lists all aliases in a specific domain + * + * @domain string dc= value of a domain's DN + */ function listAliases( $domain ) { $aliases = $this->getAlias( $domain ); return $aliases; } + /** + * getAlias - gets information about an alias + * + * This function gets information about an alias + * + * @domain string dc= value of the domain the alias is in + * @alias_uid string uid= value of the alias + * @active string "*" lists any alias, "TRUE" lists active aliases only + */ function getAlias ( $domain, $alias_uid = "*", $active = "*") { if ($active == "*") { $result = ldap_list($this->cid, "dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, "(&(objectclass=mailAlias)(uid=$alias_uid))"); @@ -248,6 +343,14 @@ return $alias; } + /** + * addAlias - adds an alias + * + * This function add an alias to the specified domain + * + * @domain string dc= value of a domain's DN + * @alias array information about an alias + */ function addAlias ( $domain, $alias) { $alias["objectclass"] = "mailAlias"; ldap_add($this->cid, "uid=".$alias['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $alias); @@ -259,6 +362,14 @@ return $result; } + /** + * modifyAlias - modifying an alias + * + * This function modifies an alias in a specific domain + * + * @domain string dc= value of a domain's DN + * @alias array information about the alias + */ function modifyAlias ( $domain, $alias) { ldap_modify($this->cid, "uid=".$alias['uid'].",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN, $alias); if ( ldap_errno($this->cid) !== 0 ) { @@ -269,6 +380,14 @@ return $result; } + /** + * deleteAlias - deletes an alias + * + * This function deletes an alias inside a specific domain + * + * @domain string dc= value of a domain's DN + * @alias string uid= value of the alias + */ function deleteAlias ( $domain, $alias) { ldap_delete($this->cid, "uid=".$alias.",dc=".$domain.",".LDAP_DOMAINS_ROOT_DN); if ( ldap_errno($this->cid) !== 0 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |