diff --git a/lam/config/lam.conf_sample b/lam/config/lam.conf_sample
index 434e3504..0605208a 100644
--- a/lam/config/lam.conf_sample
+++ b/lam/config/lam.conf_sample
@@ -11,39 +11,9 @@ admins: cn=Manager,dc=my-domain,dc=com
# password to change these preferences via webfrontend
passwd: lam
-# suffix of users
-# e.g. ou=People,dc=yourdomain,dc=org
-usersuffix: ou=people,dc=my-domain,dc=com
-
-# suffix of groups
-# e.g. ou=Groups,dc=yourdomain,dc=org
-groupsuffix: ou=groups,dc=my-domain,dc=com
-
-# suffix of Samba hosts
-# e.g. ou=machines,dc=yourdomain,dc=org
-hostsuffix: ou=machines,dc=my-domain,dc=com
-
-# suffix of Samba 3 domains
-# e.g. ou=domains,dc=yourdomain,dc=org
-domainsuffix: ou=domains,dc=my-domain,dc=com
-
-# list of attributes to show in user list
-# entries can either be predefined values (e.g. '#cn' or '#uid')
-# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')
-# values have to be seperated by semicolons
-userlistAttributes: #uid;#givenName;#sn;#uidNumber;#gidNumber
-
-# list of attributes to show in group list
-# entries can either be predefined values (e.g. '#cn' or '#gidNumber')
-# or individual ones (e.g. 'cn:Group Name')
-# values have to be seperated by semicolons
-grouplistAttributes: #cn;#gidNumber;#memberUID;#description
-
-# list of attributes to show in host list
-# entries can either be predefined values (e.g. '#cn' or '#uid')
-# or individual ones (e.g. 'cn:Host Name')
-# values have to be seperated by semicolons
-hostlistAttributes: #cn;#description;#uidNumber;#gidNumber
+# suffix of tree view
+# e.g. dc=yourdomain,dc=org
+treesuffix: dc=yourdomain,dc=org
# maximum number of rows to show in user/group/host lists
maxlistentries: 30
@@ -60,15 +30,6 @@ scriptServer:
# Number of minutes LAM caches LDAP searches.
cachetimeout: 5
-# List of used user modules
-usermodules: shadowAccount,inetOrgPerson,posixAccount,sambaSamAccount
-
-# List of used group modules
-groupmodules: posixGroup,sambaGroupMapping
-
-# List of used host modules
-hostmodules: account,sambaSamAccount,posixAccount
-
# Module settings
modules: posixAccount_minUID: 10000
@@ -80,3 +41,23 @@ modules: posixGroup_maxGID: 20000
modules: posixGroup_pwdHash: SSHA
modules: posixAccount_pwdHash: SSHA
+# List of active account types.
+activeTypes: user,group,host,smbDomain
+
+
+types: suffix_user: ou=People,dc=my-domain,dc=com
+types: attr_user: #uid;#givenName;#sn;#uidNumber;#gidNumber
+types: modules_user: inetOrgPerson,posixAccount,shadowAccount,sambaSamAccount
+
+types: suffix_group: ou=group,dc=my-domain,dc=com
+types: attr_group: #cn;#gidNumber;#memberUID;#description
+types: modules_group: posixGroup,sambaGroupMapping
+
+types: suffix_host: ou=machines,dc=my-domain,dc=com
+types: attr_host: #cn;#description;#uidNumber;#gidNumber
+types: modules_host: account,posixAccount,sambaSamAccount
+
+types: suffix_smbDomain: ou=domains,dc=my-domain,dc=com
+types: attr_smbDomain: sambaDomainName:Domain name;sambaSID:Domain SID
+types: modules_smbDomain: sambaDomain
+
diff --git a/lam/config/profiles/default.mailAlias b/lam/config/profiles/default.mailAlias
new file mode 100644
index 00000000..8d1c8b69
--- /dev/null
+++ b/lam/config/profiles/default.mailAlias
@@ -0,0 +1 @@
+
diff --git a/lam/config/profiles/default.smbDomain b/lam/config/profiles/default.smbDomain
new file mode 100644
index 00000000..8d1c8b69
--- /dev/null
+++ b/lam/config/profiles/default.smbDomain
@@ -0,0 +1 @@
+
diff --git a/lam/docs/devel/index.htm b/lam/docs/devel/index.htm
index 71b6ec8b..fc89d400 100644
--- a/lam/docs/devel/index.htm
+++ b/lam/docs/devel/index.htm
@@ -90,7 +90,8 @@ browser
+LAM is licensed under the GNU
+General Public License. This means your plugins need a compatible
+license.
+LAM is distributed with a copy of the GPL license.
+
+
+
2. Naming and position in directory structure
+Type names are usually named after the group of accounts they manage.
+However, you can use any name you want, it should be short and
+containing only a-z and 0-9. The type name is only shown in the
+configuration dialog, on all other pages LAM will show a provided alias name.
+All type modules are stored in lib/types.
+The filename must end with .inc
+and the file must have the same name as its inside class.
+
+Example:
+Our example module will provide the class
+smbDomain,
+therefore the file will be called lib/types/smbDomain.inc.
+
+
+
3. Defining the class
+All type classes have baseType
+as parent class. This provides common functionality and dummy functions
+for all required class functions.
+
+Example:
+
+
+
+
+
/**
+* The account type for Samba domains.
+*
+* @package types
+*/
+classsmbDomain extends baseType {
+
+}
+
+Every account type has its own style sheet where it can define colors
+and fonts.
+
+
+
1. File name
+The CSS files are saved in style/.
+Your file must be named type_<your
+type>.css.
+
+Example:
+
+The smbDomain type has the
+CSS file style/type_smbDomain.css.
+
+
+
2. Contents
+Take the type_user.css file as template. It is well documented.
+You have to replace all occurrences of "user" with your account type.
+
+Example:
+
+Take a look at type_user.css and type_smbDomain.css.
+
+
+
+
diff --git a/lam/docs/devel/type_general.htm b/lam/docs/devel/type_general.htm
new file mode 100644
index 00000000..8691ea74
--- /dev/null
+++ b/lam/docs/devel/type_general.htm
@@ -0,0 +1,90 @@
+
+
+
+ Type HowTo - General type options
+
+
+
+
+
Type HowTo - General type options
+
+
+
+
+
1. Alias name
+The type name is very limited, therefore every type has an alias name. This alias name has no limitations and
+can be translated. It may contain special characters but make sure that
+it does not contain HTML special characters like "<".
+
+The alias name is specified
+with getAlias().
+
+Example:
+
+Our smbDomain type will get
+the alias "Samba domains".
+
+
+
+
+
/**
+ * Returns the alias name of this account type.
+ *
+ * @return string alias name
+ */
+ function
+ getAlias() {
+ return _("Samba domains");
+ }
+
+
+
+
+
+
+
2. Description
+
+Each type has a description so that the user knows what accounts he can
+manage with that type. The description is displayed in the LAM
+configuration editor.
+
+The description is specified with getDescription().
+
+Example:
+
+Our smbDomain type has the
+description "Samba 3 domain entries".
+
+
+
+
+
/**
+ * Returns the description of this account type.
+ *
+ * @return string description
+ */
+ function
+ getDescription() {
+ return _("Samba 3 domain
+entries");
+ }
+
+You have to provide an icon for your account type. This icon is
+displayed in the upper frame next to the link to your account list.
+The format of the image must be PNG
+and the size should be between 20x20
+and 25x25 pixels.
+
+The file is stored in graphics/
+with the file name <your
+type>.png.
+
+
+Example:
+
+The smbDomain type has the
+icon graphics/smbDomain.png.
+
If you write new account modules they
+may not fit in the existing group of account types (user, group, host,
+...). In this case you can easily create a new account type.
+This document provides a step-by-step description to build a type
+module. The smbDomain
+module which handles Samba domains is used as example.
+
+
+
diff --git a/lam/docs/devel/type_list.htm b/lam/docs/devel/type_list.htm
new file mode 100644
index 00000000..832752d7
--- /dev/null
+++ b/lam/docs/devel/type_list.htm
@@ -0,0 +1,181 @@
+
+
+
+ Type HowTo - Custom list view
+
+
+
+
+
Type HowTo - Custom list view
+
+
+
+
+
1. Default list attributes
+
+Here you can specify what attributes are shown as default in the list
+view.
+
+The default attributes are
+specified
+with getDefaultListAttributes().
+
+Example:
+
+Our smbDomain type will show
+the attributes "#sambaDomainName;#sambaSID" by default.
+
+
+
+
+
/**
+ * Returns the default attribute list for this
+account type.
+ *
+ * @return string attribute list
+ */
+ functiongetDefaultListAttributes() {
+ return
+"#sambaDomainName;#sambaSID";
+ }
+
+
+
+
+
+
+
2. Pretranslated attribute descriptions
+
+You can provide translated descriptions for common attributes. This way
+the user only specifies the attributes and LAM will show a description
+for each language.
+
+The descriptions are specified with getListAttributeDescriptions().
+
+Example:
+
+Our smbDomain type has
+descriptions for sambaSID and sambaDomainName.
+
+
+
+
+
/**
+ * Returns a list of attributes which have a
+translated description.
+ * This is used for the head row in the list view.
+ *
+ * @return array list of descriptions
+ */
+ functiongetListAttributeDescriptions() {
+ return array(
+ "sambaSID"
+=> _("Domain SID"),
+
+"sambaDomainName" => _("Domain name")
+ );
+ }
+
+
+
+
+
+
+
+
3. Specifying a custom list view
+The default list view has only very generic labels for the buttons and
+navigation bar. So you should at least provide some new labels which
+fit to your type.
+
+The class name of your list view is specified with getListClassName().
+
+Example:
+
+Our smbDomain type sets the
+list view class to lamSmbDomainList.
+The list class is defined in the same file as your type class
+(smbDomain.inc in this case).
+The labels are set in the constructor. Do not forget to call the parent
+constructor first.
+
+If you want to change more than just the labels, take a look at lib/lists.inc and lib/types/user.inc. When a list is
+displayed then the showPage()
+function is called. You can overwrite this function to display a
+completly new list or just one of the other functions.
+
+
+
+
+
/**
+* Returns the class name for the list object.
+*
+* @return string class name
+*/
+function getListClassName()
+{
+ return "lamSmbDomainList";
+}
+
+
+/**
+ * Generates the list view.
+ *
+ * @package lists
+ * @author Roland Gruber
+ *
+ */
+class lamSmbDomainList
+extends lamList {
+
+ /**
+ * Constructor
+ *
+ * @param string $type account type
+ * @return lamList list object
+ */
+ function lamSmbDomainList($type) {
+ parent::lamList($type);
+ $this->labels = array(
+ 'nav' =>
+_("%s domain(s) found"),
+
+'error_noneFound' => _("No domains found!"),
+ 'newEntry'
+=> _("New domain"),
+ 'deleteEntry'
+=> _("Delete domain"),
+ 'createPDF'
+=> _("Create PDF for selected domain(s)"),
+ 'createPDFAll'
+=> _("Create PDF for all domains"));
+ }
+
+}
+
+You have to provide a default profile for your account type. If you do
+not want to specify default values then just provide an empty file.
+Save your profile as default.<your
+type> in config/profiles.
+
+
+Example:
+
+The smbDomain type has only
+an empty default profile. It is saved as config/profiles/default.smbDomain.
+
This document describes the type
+interface for LDAP Account Manager
+
+Account types are used to manage a group of accounts by grouping one or
+more account modules. Examples for account types are user, group, host
+and smbDomain.
+
+
1. Location and naming of types
+
+All LAM types are placed in lib/types/ and are named "<class
+name>.inc".
+E.g. if you create a new type and its class name is "myUser" then the
+filename would be "myUser.inc".
+
+The class name of a type must contain only a-z, A-Z, 0-9, -, and _.
+All type classes should extend the baseType class.
+
+
2. Functions
+
2.1. getAlias
+
+
+
+
+
+
function getAlias()
+
+
+
+
+
+Returns the alias name for
+this type. E.g. the alias for smbDomain is "Samba domains".
+
+
2.2. getDescription
+
+
+
+
+
+
function getDescription()
+
+
+
+
+
+Returns a description for the
+account type. This should be a short sentence describing the account
+type.
+
+
2.3. getListClassName
+
+
+
+
+
+
function getListClassName()
+
+
+
+
+
+Here you can specify your own class to handle the list view. The class
+must be a subclass of lamList.
+
+
2.4. getDefaultListAttributes
+
+
+
+
+
+
function getDefaultListAttributes()
+
+
+
+
+
+Returns the default setting
+for the displayed list attributes. It is used as default for config and
+the syntax is equal to the config setting.
+
+
2.5. getListAttributeDescriptions
+
+
+
+
+
+
function getListAttributeDescriptions()
+
+
+
+
+
+Returns a hash array which contains predefined, translated descriptions
+of LDAP attributes.
+
+
+Example:
+
+return array(
+ "sambaSID" => _("Domain SID"),
+ "sambaDomainName" => _("Domain name")
+ );
+
+
+
+
+
+
+
+
diff --git a/lam/graphics/group.png b/lam/graphics/group.png
new file mode 100644
index 00000000..3e767c7c
Binary files /dev/null and b/lam/graphics/group.png differ
diff --git a/lam/graphics/mailAlias.png b/lam/graphics/mailAlias.png
new file mode 100644
index 00000000..bd77affe
Binary files /dev/null and b/lam/graphics/mailAlias.png differ
diff --git a/lam/graphics/smbDomain.png b/lam/graphics/smbDomain.png
new file mode 100644
index 00000000..2769a479
Binary files /dev/null and b/lam/graphics/smbDomain.png differ
diff --git a/lam/help/help.inc b/lam/help/help.inc
index 2c083288..91c2e7a6 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -153,21 +153,7 @@ $helpArray = array (
"601" => array ("ext" => "FALSE", "Headline" => _("OU-Editor") . " - " . _("New organizational unit"),
"Text" => _("This will create a new organizational unit under the selected one.")),
"602" => array ("ext" => "FALSE", "Headline" => _("OU-Editor") . " - " . _("Delete organizational unit"),
- "Text" => _("This will delete the selected organizational unit. The OU has to be empty.")),
- "651" => array ("ext" => "FALSE", "Headline" => _("Domain name"),
- "Text" => _("The name of your Windows domain or workgroup.")),
- "652" => array ("ext" => "FALSE", "Headline" => _("Suffix"),
- "Text" => _("The domain entry will be saved under this suffix.")),
- "653" => array ("ext" => "FALSE", "Headline" => _("Domain SID"),
- "Text" => _("The SID of your Samba server. Get it with \"net getlocalsid\".")),
- "654" => array ("ext" => "FALSE", "Headline" => _("Next RID"),
- "Text" => _("Next RID to use when creating accounts.")),
- "655" => array ("ext" => "FALSE", "Headline" => _("Next User RID"),
- "Text" => _("Next RID to use when creating user accounts.")),
- "656" => array ("ext" => "FALSE", "Headline" => _("Next Group RID"),
- "Text" => _("Next RID to use when creating groups.")),
- "657" => array ("ext" => "FALSE", "Headline" => _("Algorithmic RID Base"),
- "Text" => _("Used for calculating RIDs from UID/GID. Do not change if unsure."))
+ "Text" => _("This will delete the selected organizational unit. The OU has to be empty."))
);
diff --git a/lam/lib/account.inc b/lam/lib/account.inc
index b4b5bae2..e02a58bd 100644
--- a/lam/lib/account.inc
+++ b/lam/lib/account.inc
@@ -357,50 +357,50 @@ function pwd_is_enabled($hash) {
else return true;
}
- /**
- * Returns an array with all Samba 3 domain entries under the given suffix
- *
- * @param string $suffix search suffix
- * @return array list of samba3domain objects
- */
- function search_domains($suffix) {
- $ret = array();
- $attr = array("DN", "sambaDomainName", "sambaSID", "sambaNextRid", "sambaNextGroupRid",
- "sambaNextUserRid", "sambaAlgorithmicRidBase");
- $sr = @ldap_search($_SESSION['ldap']->server(), $suffix, "objectClass=sambaDomain", $attr);
- if ($sr) {
- $units = ldap_get_entries($_SESSION['ldap']->server, $sr);
- // delete count entry
- unset($units['count']);
- // extract attributes
- for ($i = 0; $i < sizeof($units); $i++) {
- $ret[$i] = new samba3domain();
- $ret[$i]->dn = $units[$i]['dn'];
- $ret[$i]->name = $units[$i]['sambadomainname'][0];
- $ret[$i]->SID = $units[$i]['sambasid'][0];
- if (isset($units[$i]['sambanextrid'][0])) $ret[$i]->nextRID = $units[$i]['sambanextrid'][0];
- if (isset($units[$i]['sambanextgrouprid'][0])) $ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0];
- if (isset($units[$i]['sambanextuserrid'][0])) $ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0];
- if (isset($units[$i]['sambaalgorithmicridbase'][0])) $ret[$i]->RIDbase = $units[$i]['sambaalgorithmicridbase'][0];
- }
- // sort array by domain name
- usort($ret, "cmp_domain");
+/**
+* Returns an array with all Samba 3 domain entries under the given suffix
+*
+* @return array list of samba3domain objects
+*/
+function search_domains() {
+ $suffix = $_SESSION['config']->get_Suffix('smbDomain');
+ $ret = array();
+ $attr = array("DN", "sambaDomainName", "sambaSID", "sambaNextRid", "sambaNextGroupRid",
+ "sambaNextUserRid", "sambaAlgorithmicRidBase");
+ $sr = @ldap_search($_SESSION['ldap']->server(), $suffix, "objectClass=sambaDomain", $attr);
+ if ($sr) {
+ $units = ldap_get_entries($_SESSION['ldap']->server, $sr);
+ // delete count entry
+ unset($units['count']);
+ // extract attributes
+ for ($i = 0; $i < sizeof($units); $i++) {
+ $ret[$i] = new samba3domain();
+ $ret[$i]->dn = $units[$i]['dn'];
+ $ret[$i]->name = $units[$i]['sambadomainname'][0];
+ $ret[$i]->SID = $units[$i]['sambasid'][0];
+ if (isset($units[$i]['sambanextrid'][0])) $ret[$i]->nextRID = $units[$i]['sambanextrid'][0];
+ if (isset($units[$i]['sambanextgrouprid'][0])) $ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0];
+ if (isset($units[$i]['sambanextuserrid'][0])) $ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0];
+ if (isset($units[$i]['sambaalgorithmicridbase'][0])) $ret[$i]->RIDbase = $units[$i]['sambaalgorithmicridbase'][0];
}
- return $ret;
+ // sort array by domain name
+ usort($ret, "cmp_domain");
}
+ return $ret;
+}
- /**
- * Helper function to sort the domains
- *
- * @param string $a first argument to compare
- * @param string $b second argument to compare
- * @return integer 0 if equal, 1 if $a is greater, -1 if $b is greater
- */
- function cmp_domain($a, $b) {
- if ($a->name == $b->name) return 0;
- elseif ($a->name == max($a->name, $b->name)) return 1;
- else return -1;
- }
+/**
+* Helper function to sort the domains
+*
+* @param string $a first argument to compare
+* @param string $b second argument to compare
+* @return integer 0 if equal, 1 if $a is greater, -1 if $b is greater
+*/
+function cmp_domain($a, $b) {
+ if ($a->name == $b->name) return 0;
+ elseif ($a->name == max($a->name, $b->name)) return 1;
+ else return -1;
+}
/**
@@ -498,7 +498,7 @@ function get_preg($argument, $regexp) {
$pregexpr = '/^(([a-zA-Z0-9\\.\\_-])+(,[a-zA-Z0-9\\.\\_-])*)*$/';
break;
case "domainname": // Windows Domainname
- $pregexpr = '/^([a-z0-9\\.\\_-])+$/';
+ $pregexpr = '/^([A-Za-z0-9\\.\\_-])+$/';
break;
case "unixhost": // Unix hosts
$pregexpr = '/^([a-z0-9,\\.\\_-])*$/';
@@ -533,6 +533,8 @@ function get_preg($argument, $regexp) {
case 'dn': // LDAP DN
$pregexpr = '/^([^=,]+=[^=,]+)(,([^=,]+=[^=,]+))*$/';
break;
+ case 'domainSID': // Samba domain SID
+ $pregexpr = "/^S\\-[0-9]\\-[0-9]\\-[0-9]{2,2}\\-[0-9]+\\-[0-9]+\\-[0-9]+$/";
}
if ($pregexpr!='')
if (preg_match($pregexpr, $argument)) {
diff --git a/lam/lib/baseType.inc b/lam/lib/baseType.inc
new file mode 100644
index 00000000..9c905d09
--- /dev/null
+++ b/lam/lib/baseType.inc
@@ -0,0 +1,90 @@
+
\ No newline at end of file
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index 69e3a5d0..6a2ed81c 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -33,6 +33,8 @@ $Id$
include_once("status.inc");
/** Used to get module information. */
include_once("modules.inc");
+/** Used to get type information. */
+include_once("types.inc");
/**
* Sets language settings for automatic translation
@@ -129,28 +131,9 @@ class Config {
/** Password to edit preferences */
var $Passwd;
- /** LDAP suffix for users */
- var $usersuffix;
-
- /** LDAP suffix for groups */
- var $groupsuffix;
-
- /** LDAP suffix for Samba hosts */
- var $hostsuffix;
-
- /** LDAP suffix for Samba 3 domains */
- var $domainsuffix;
-
/** LDAP suffix for tree view */
var $treesuffix;
- /** Attributes that are shown in the user list */
- var $userlistAttributes;
- /** Attributes that are shown in the group list */
- var $grouplistAttributes;
- /** Attributes that are shown in the host list */
- var $hostlistAttributes;
-
/** Maximum number of rows shown in user/group/host lists */
var $maxlistentries;
@@ -160,6 +143,9 @@ class Config {
/** module settings */
var $moduleSettings = array();
+ /** type settings */
+ var $typeSettings = array();
+
/**
* Path to external lamdaemon script on server where it is executed
*
@@ -179,20 +165,16 @@ class Config {
/** LDAP cache timeout */
var $cachetimeout;
- var $usermodules = "posixAccount,shadowAccount,quota";
- /** Account modules for groups */
- var $groupmodules = "posixGroup,quota";
- /** Account modules for hosts */
- var $hostmodules = "account,sambaSamAccount";
+ /** Active account types */
+ var $activeTypes = "user,group,host,smbDomain";
/** Name of configuration file */
var $file;
/** List of all settings in config file */
- var $settings = array("ServerURL", "Passwd", "Admins", "usersuffix", "groupsuffix", "hostsuffix", "treesuffix",
- "domainsuffix", "userlistAttributes", "grouplistAttributes", "hostlistAttributes", "maxlistentries",
+ var $settings = array("ServerURL", "Passwd", "Admins", "treesuffix", "maxlistentries",
"defaultLanguage", "scriptPath", "scriptServer", "cachetimeout",
- "usermodules", "groupmodules", "hostmodules", "modules");
+ "modules", "activeTypes", "types");
/**
@@ -233,7 +215,13 @@ class Config {
if (strtolower(substr($line, 0, $keylen + 2)) == "modules: ") {
$option = substr($line, $keylen + 2, strlen($line) - $keylen - 2);
$pos = strpos($option, ":");
- $this->moduleSettings[substr($option, 0, $pos)] = explode("+::+", substr($option, $pos + 2, strlen($option) - $pos - 2));
+ $this->moduleSettings[substr($option, 0, $pos)] = explode("+::+", substr($option, $pos + 2));
+ }
+ // type settings
+ elseif (strtolower(substr($line, 0, $keylen + 2)) == "types: ") {
+ $option = substr($line, $keylen + 2, strlen($line) - $keylen - 2);
+ $pos = strpos($option, ":");
+ $this->typeSettings[substr($option, 0, $pos)] = substr($option, $pos + 2);
}
// general settings
else {
@@ -246,7 +234,7 @@ class Config {
fclose($file);
}
// check modules
- $scopes = array('user', 'group', 'host');
+ $scopes = $this->get_ActiveTypes();
for ($s = 0; $s < sizeof($scopes); $s++) {
$scope = $scopes[$s];
$moduleVar = $scope . "modules";
@@ -293,6 +281,15 @@ class Config {
$file_array[$i] = "modules: " . $name . ": " . implode("+::+", $this->moduleSettings[$name]) . "\n";
$mod_saved[] = $name; // mark keyword as saved
}
+ // type settings
+ elseif (strtolower(substr($line, 0, $keylen + 2)) == "types: ") {
+ $option = substr($line, $keylen + 2, strlen($line) - $keylen - 2);
+ $pos = strpos($option, ":");
+ $name = substr($option, 0, $pos);
+ if (!isset($this->typeSettings[$name])) continue;
+ $file_array[$i] = "types: " . $name . ": " . $this->typeSettings[$name] . "\n";
+ $mod_saved[] = $name; // mark keyword as saved
+ }
// general settings
else {
$file_array[$i] = $keyword . ": " . $this->$keyword . "\n";
@@ -308,30 +305,14 @@ class Config {
if (!in_array("Admins", $saved)) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
"# names have to be seperated by semicolons\n" .
"# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Admins . "\n");
- if (!in_array("usersuffix", $saved)) array_push($file_array, "\n\n# suffix of users\n" .
- "# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->usersuffix . "\n");
- if (!in_array("groupsuffix", $saved)) array_push($file_array, "\n\n# suffix of groups\n" .
- "# e.g. ou=Groups,dc=yourdomain,dc=org\n" . "groupsuffix: " . $this->groupsuffix . "\n");
- if (!in_array("hostsuffix", $saved)) array_push($file_array, "\n\n# suffix of hosts\n" .
- "# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->hostsuffix . "\n");
- if (!in_array("domainsuffix", $saved)) array_push($file_array, "\n\n# suffix of Samba 3 domains\n" .
- "# e.g. ou=domains,dc=yourdomain,dc=org\n" . "domainsuffix: " . $this->domainsuffix . "\n");
if (!in_array("treesuffix", $saved)) array_push($file_array, "\n\n# suffix of tree view\n" .
"# e.g. dc=yourdomain,dc=org\n" . "treesuffix: " . $this->treesuffix . "\n");
- if (!in_array("userlistAttributes", $saved)) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
- "\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes . "\n");
- if (!in_array("grouplistAttributes", $saved)) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
- "\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes . "\n");
- if (!in_array("hostlistAttributes", $saved)) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
- "\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes . "\n");
if (!in_array("maxlistentries", $saved)) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries . "\n");
if (!in_array("defaultLanguage", $saved)) array_push($file_array, "\n\n# default language (a line from config/language)\n" . "defaultLanguage: " . $this->defaultLanguage . "\n");
if (!in_array("scriptPath", $saved)) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n");
if (!in_array("scriptServer", $saved)) array_push($file_array, "\n\n# Server of external Script\n" . "scriptServer: " . $this->scriptServer . "\n");
if (!in_array("cachetimeout", $saved)) array_push($file_array, "\n\n# Number of minutes LAM caches LDAP searches.\n" . "cacheTimeout: " . $this->cachetimeout . "\n");
- if (!in_array("usermodules", $saved)) array_push($file_array, "\n\n# List of used user modules\n" . "usermodules: " . $this->usermodules . "\n");
- if (!in_array("groupmodules", $saved)) array_push($file_array, "\n\n# List of used group modules\n" . "groupmodules: " . $this->groupmodules . "\n");
- if (!in_array("hostmodules", $saved)) array_push($file_array, "\n\n# List of used host modules\n" . "hostmodules: " . $this->hostmodules . "\n");
+ if (!in_array("activeTypes", $saved)) array_push($file_array, "\n\n# List of active account types.\n" . "activeTypes: " . $this->activeTypes . "\n");
// check if all module settings were added
$m_settings = array_keys($this->moduleSettings);
for ($i = 0; $i < sizeof($m_settings); $i++) {
@@ -339,54 +320,27 @@ class Config {
array_push($file_array, "modules: " . $m_settings[$i] . ": " . implode("+::+", $this->moduleSettings[$m_settings[$i]]) . "\n");
}
}
+ // check if all type settings were added
+ $t_settings = array_keys($this->typeSettings);
+ for ($i = 0; $i < sizeof($t_settings); $i++) {
+ if (!in_array($t_settings[$i], $mod_saved)) {
+ array_push($file_array, "types: " . $t_settings[$i] . ": " . $this->typeSettings[$t_settings[$i]] . "\n");
+ }
+ }
$file = fopen($conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
fclose($file);
@chmod ($conffile, 0600);
+ StatusMessage("INFO", _("Your settings were successfully saved.") , " (" . $conffile . ")");
}
else {
- StatusMessage("ERROR", "", _("Cannot open config file!") . " (" . $conffile . ")");
+ StatusMessage("ERROR", _("Cannot open config file!") . " (" . $conffile . ")");
exit;
}
}
}
- /** Prints current preferences */
- function printconf() {
- echo "" . _("Server address") . ": " . $this->ServerURL . " \n";
- echo "" . _("Cache timeout") . ": " . $this->cachetimeout . " \n";
- echo "" . _("UserSuffix") . ": " . $this->usersuffix . " \n";
- echo "" . _("GroupSuffix") . ": " . $this->groupsuffix . " \n";
- echo "" . _("HostSuffix") . ": " . $this->hostsuffix . " \n";
- echo "" . _("DomainSuffix") . ": " . $this->domainsuffix . " \n";
- echo "" . _("TreeSuffix") . ": " . $this->treesuffix . " \n";
- echo "" . _("Attributes in User List") . ": " . $this->userlistAttributes . " \n";
- echo "" . _("Attributes in Group List") . ": " . $this->grouplistAttributes . " \n";
- echo "" . _("Attributes in Host List") . ": " . $this->hostlistAttributes . " \n";
- echo "" . _("Maximum list entries") . ": " . $this->maxlistentries . " \n";
- echo "" . _("Default language") . ": " . $this->defaultLanguage . " \n";
- echo "" . _("Path to external script") . ": " . $this->scriptPath . " \n";
- echo "" . _("Server of external script") . ": " . $this->scriptServer . " \n";
- echo "" . _("List of valid users") . ": " . $this->Admins . " \n";
- echo "" . _("User modules") . ": " . $this->usermodules . " \n";
- echo "" . _("Group modules") . ": " . $this->groupmodules . " \n";
- echo "" . _("Host modules") . ": " . $this->hostmodules . "