lib/config.inc
Properties
Description
This file includes functions to manage the configuration files.Functions
setSSLCaCert( ) : n/a
Description
Sets the environment variables for custom SSL CA certificates.Return value
Type | Description |
---|---|
n/a | n/a |
setlanguage( ) : n/a
Description
Sets language settings for automatic translationReturn value
Type | Description |
---|---|
n/a | n/a |
checkChmod( $right, $target, $chmod, ) : \true,
Description
Checks whether a specific flag in the rights string is set.Arguments
Name | Type | Description | Default |
---|---|---|---|
$right | n/a | read,write or execute |
|
$target | n/a | owner,group or other |
|
$chmod | n/a | the chmod rights |
Return value
Type | Description |
---|---|
\true, | if the chmod $right for $target were set |
getConfigProfiles( ) : array
Description
Returns an array of string with all available configuration profiles (without .conf)Return value
Type | Description |
---|---|
array | profile names |
deleteConfigProfile( String $name, ) : String
Description
Deletes the given server profile.Arguments
Name | Type | Description | Default |
---|---|---|---|
$name | String | profile name |
Return value
Type | Description |
---|---|
String | null if success or error message if failed |
LAMVersion( ) : string
Description
Returns the version number of this LAM installation.Format:
Major/minor version are always numbers, patch level may contain letters for inofficial releases only (e.g. 0.5.alpha1).
Return value
Type | Description |
---|---|
string | version number |
metaRefresh( string $page, ) : n/a
Description
Prints a meta refresh pageArguments
Name | Type | Description | Default |
---|---|---|---|
$page | string | the URL of the target page |
Return value
Type | Description |
---|---|
n/a | n/a |
isAccountTypeHidden( String $type, ) : boolean
Description
Checks if the given account type is hidden.Arguments
Name | Type | Description | Default |
---|---|---|---|
$type | String | account type (e.g. user) |
Return value
Type | Description |
---|---|
boolean | is hidden |
Classes
LAMConfig
Description
This class manages .conf files.Methods
__construct, check_Passwd, getAccessLevel, getHttpAuthentication, getLamProMailFrom, getLamProMailIsHTML, getLamProMailReplyTo, getLamProMailSubject, getLamProMailText, getLoginMethod, getLoginSearchDN, getLoginSearchFilter, getLoginSearchPassword, getLoginSearchSuffix, getName, getPath, getToolSettings, getUseTLS, get_AccountModules, get_ActiveTypes, get_Admins, get_Adminstring, get_ServerURL, get_Suffix, get_cacheTimeout, get_cacheTimeoutSec, get_defaultLanguage, get_listAttributes, get_moduleSettings, get_scriptPath, get_scriptRights, get_scriptServers, get_searchLimit, get_typeSettings, hashPassword, isWritable, reload, save, setAccessLevel, setHttpAuthentication, setLamProMailFrom, setLamProMailIsHTML, setLamProMailReplyTo, setLamProMailSubject, setLamProMailText, setLoginMethod, setLoginSearchDN, setLoginSearchFilter, setLoginSearchPassword, setLoginSearchSuffix, setToolSettings, setUseTLS, set_AccountModules, set_ActiveTypes, set_Adminstring, set_Passwd, set_ServerURL, set_Suffix, set_cacheTimeout, set_defaultLanguage, set_listAttributes, set_moduleSettings, set_scriptPath, set_scriptRights, set_scriptServers, set_searchLimit, set_typeSettings,__construct( String $file, ) : n/a
Description
Loads preferences from config fileArguments
Name | Type | Description | Default |
---|---|---|---|
$file | String | file name without ".conf" (e.g. lam) |
Return value
Type | Description |
---|---|
n/a | n/a |
check_Passwd( String $password, ) : boolean
Description
Checks if the given password matches.Arguments
Name | Type | Description | Default |
---|---|---|---|
$password | String |
Return value
Type | Description |
---|---|
boolean | true, if matches |
getAccessLevel( ) : int
Description
Returns the access level for this profile.Return value
Type | Description |
---|---|
int | level |
getHttpAuthentication( ) : String
Description
Returns if HTTP authentication should be used.Return value
Type | Description |
---|---|
String | $httpAuthentication use HTTP authentication ('true' or 'false') |
getLamProMailFrom( ) : String
Description
Returns the sender address for password reset mails.Return value
Type | Description |
---|---|
String | mail address |
getLamProMailIsHTML( ) : boolean
Description
Returns if the password reset mail content should be treated as HTML.Return value
Type | Description |
---|---|
boolean | HTML or text |
getLamProMailReplyTo( ) : String
Description
Returns the reply-to address for password reset mails.Return value
Type | Description |
---|---|
String | mail address |
getLamProMailSubject( ) : String
Description
Returns the subject for password reset mails.Return value
Type | Description |
---|---|
String | subject |
getLamProMailText( ) : String
Description
Returns the mail body for password reset mails.Return value
Type | Description |
---|---|
String | body |
getLoginMethod( ) : String
Description
Returns the login method.Return value
Type | Description |
---|---|
String | login method |
Tags
Name | Description |
---|---|
see | |
see |
getLoginSearchDN( ) : String
Description
Returns the DN for the login search bind user.Return value
Type | Description |
---|---|
String | DN |
getLoginSearchFilter( ) : String
Description
Returns the login search filter.Return value
Type | Description |
---|---|
String | search filter |
getLoginSearchPassword( ) : String
Description
Returns the password for the login search bind user.Return value
Type | Description |
---|---|
String | password |
getLoginSearchSuffix( ) : String
Description
Returns the login search suffix.Return value
Type | Description |
---|---|
String | suffix |
getName( ) : String
Description
Returns the name of the config fileReturn value
Type | Description |
---|---|
String | name |
getPath( ) : string
Description
Returns the path to the config file.Return value
Type | Description |
---|---|
string | path on filesystem |
getToolSettings( ) : array
Description
Returns the tool settings.Return value
Type | Description |
---|---|
array | $toolSettings tool settings |
getUseTLS( ) : String
Description
Returns if TLS is activated.Return value
Type | Description |
---|---|
String | yes or no |
get_AccountModules( string $scope, ) : array
Description
Returns an array of all selected account modulesArguments
Name | Type | Description | Default |
---|---|---|---|
$scope | string | account type |
Return value
Type | Description |
---|---|
array | user modules |
get_ActiveTypes( ) : array
Description
Returns a list of active account types.Return value
Type | Description |
---|---|
array | list of types |
get_Admins( ) : array
Description
Returns an array of string with all admin namesReturn value
Type | Description |
---|---|
array | the admin names |
get_Adminstring( ) : string
Description
Returns all admin users seperated by semicolonsReturn value
Type | Description |
---|---|
string | the admin string |
get_ServerURL( ) : string
Description
Returns the server address as stringReturn value
Type | Description |
---|---|
string | server address |
get_Suffix( string $scope, ) : string
Description
Returns the LDAP suffix for the given account typeArguments
Name | Type | Description | Default |
---|---|---|---|
$scope | string | account type |
Return value
Type | Description |
---|---|
string | the LDAP suffix |
get_cacheTimeout( ) : integer
Description
Returns the LDAP cache timeout in minutesReturn value
Type | Description |
---|---|
integer | cache time |
get_cacheTimeoutSec( ) : integer
Description
Returns the LDAP cache timeout in secondsReturn value
Type | Description |
---|---|
integer | cache time |
get_defaultLanguage( ) : string
Description
Returns the default language stringReturn value
Type | Description |
---|---|
string | default language |
get_listAttributes( string $scope, ) : string
Description
Returns the list of attributes to show in user listArguments
Name | Type | Description | Default |
---|---|---|---|
$scope | string | account type |
Return value
Type | Description |
---|---|
string | the attribute list |
get_moduleSettings( ) : array
Description
Returns a list of saved module settingsReturn value
Type | Description |
---|---|
array | list of settings: array(name => value) |
get_scriptPath( ) : string
Description
Returns the path to the external scriptReturn value
Type | Description |
---|---|
string | script path |
get_scriptRights( ) : string
Description
Returns the chmod value for new home directories.Return value
Type | Description |
---|---|
string | rights |
get_scriptServers( ) : string
Description
Returns the servers of the external script as a ArrayReturn value
Type | Description |
---|---|
string | script servers |
get_searchLimit( ) : integer
Description
Returns the LDAP search limit.Return value
Type | Description |
---|---|
integer | search limit |
get_typeSettings( ) : array
Description
Returns a list of saved type settingsReturn value
Type | Description |
---|---|
array | list of settings: array(name => value) |
hashPassword( String $password, String $salt, ) : String
Description
Returns the hashed password.Arguments
Name | Type | Description | Default |
---|---|---|---|
$password | String | password |
|
$salt | String | salt |
Return value
Type | Description |
---|---|
String | hash value |
isWritable( ) : boolean
Description
Returns if the file can be written on the filesystem.Return value
Type | Description |
---|---|
boolean | true if file is writable |
reload( ) : boolean
Description
Reloads preferences from config fileReturn value
Type | Description |
---|---|
boolean | true if file was readable |
setAccessLevel( int $level, ) : n/a
Description
Sets the access level for this profile.Arguments
Name | Type | Description | Default |
---|---|---|---|
$level | int | level |
Return value
Type | Description |
---|---|
n/a | n/a |
setHttpAuthentication( String $httpAuthentication, ) : n/a
Description
Specifies if HTTP authentication should be used.Arguments
Name | Type | Description | Default |
---|---|---|---|
$httpAuthentication | String | use HTTP authentication ('true' or 'false') |
Return value
Type | Description |
---|---|
n/a | n/a |
setLamProMailFrom( String $lamProMailFrom, ) : boolean
Description
Sets the sender address for password reset mails.Arguments
Name | Type | Description | Default |
---|---|---|---|
$lamProMailFrom | String | mail address |
Return value
Type | Description |
---|---|
boolean | true if address is valid |
setLamProMailIsHTML( boolean $lamProMailIsHTML, ) : n/a
Description
Sets if the password reset mail content should be treated as HTML.Arguments
Name | Type | Description | Default |
---|---|---|---|
$lamProMailIsHTML | boolean |
Return value
Type | Description |
---|---|
n/a | n/a |
setLamProMailReplyTo( String $lamProMailReplyTo, ) : boolean
Description
Sets the reply-to address for password reset mails.Arguments
Name | Type | Description | Default |
---|---|---|---|
$lamProMailReplyTo | String | mail address |
Return value
Type | Description |
---|---|
boolean | true if address is valid |
setLamProMailSubject( String $lamProMailSubject, ) : n/a
Description
Sets the subject for password reset mails.Arguments
Name | Type | Description | Default |
---|---|---|---|
$lamProMailSubject | String | subject |
Return value
Type | Description |
---|---|
n/a | n/a |
setLamProMailText( String $lamProMailText, ) : n/a
Description
Sets the mail body for password reset mails.Arguments
Name | Type | Description | Default |
---|---|---|---|
$lamProMailText | String | body |
Return value
Type | Description |
---|---|
n/a | n/a |
setLoginMethod( String $loginMethod, ) : n/a
Description
Sets the login method.Arguments
Name | Type | Description | Default |
---|---|---|---|
$loginMethod | String |
Return value
Type | Description |
---|---|
n/a | n/a |
setLoginSearchDN( String $loginSearchDN, ) : boolean
Description
Sets the DN for the login search bind user.Arguments
Name | Type | Description | Default |
---|---|---|---|
$loginSearchDN | String | DN |
Return value
Type | Description |
---|---|
boolean | true if DN is valid |
setLoginSearchFilter( String $loginSearchFilter, ) : n/a
Description
Sets the login search filter.Arguments
Name | Type | Description | Default |
---|---|---|---|
$loginSearchFilter | String | search filter |
Return value
Type | Description |
---|---|
n/a | n/a |
setLoginSearchPassword( String $loginSearchPassword, ) : n/a
Description
Sets the password for the login search bind user.Arguments
Name | Type | Description | Default |
---|---|---|---|
$loginSearchPassword | String | password |
Return value
Type | Description |
---|---|
n/a | n/a |
setLoginSearchSuffix( String $loginSearchSuffix, ) : n/a
Description
Sets the login search suffix.Arguments
Name | Type | Description | Default |
---|---|---|---|
$loginSearchSuffix | String | suffix |
Return value
Type | Description |
---|---|
n/a | n/a |
setToolSettings( array $toolSettings, ) : boolean
Description
Sets the tool settings.Arguments
Name | Type | Description | Default |
---|---|---|---|
$toolSettings | array | tool settings |
Return value
Type | Description |
---|---|
boolean | true if ok |
setUseTLS( $useTLS, ) : boolean
Description
Sets if TLS is activated.Arguments
Name | Type | Description | Default |
---|---|---|---|
$useTLS | n/a |
Return value
Type | Description |
---|---|
boolean | true if $useTLS has correct format |
set_AccountModules( array $modules, string $scope, ) : boolean
Description
Sets the selected account modulesArguments
Name | Type | Description | Default |
---|---|---|---|
$modules | array | array with module names (not aliases!) |
|
$scope | string | account type |
Return value
Type | Description |
---|---|
boolean | true if $modules has correct format |
set_ActiveTypes( $types, ) : n/a
Description
Sets the list of active types.Arguments
Name | Type | Description | Default |
---|---|---|---|
$types | n/a |
Return value
Type | Description |
---|---|
n/a | n/a |
set_Adminstring( string $value, ) : boolean
Description
Sets the admin stringArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new admin string that contains all admin users seperated by semicolons |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_Passwd( string $value, ) : boolean
Description
Sets the preferences wizard passwordArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new password |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_ServerURL( string $value, ) : boolean
Description
Sets the server addressArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new server address |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_Suffix( string $scope, string $value, ) : boolean
Description
Sets the LDAP suffix where accounts are savedArguments
Name | Type | Description | Default |
---|---|---|---|
$scope | string | account type |
|
$value | string | new LDAP suffix |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_cacheTimeout( integer $value, ) : boolean
Description
Sets the LDAP cache timeout in minutes (0,1,2,5,10,15)Arguments
Name | Type | Description | Default |
---|---|---|---|
$value | integer | new cache timeout |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_defaultLanguage( string $value, ) : boolean
Description
Sets the default language stringArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new default language |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_listAttributes( string $value, string $scope, ) : boolean
Description
Sets the list of attributes to show in user listArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new attribute string |
|
$scope | string | account type |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_moduleSettings( array $settings, ) : boolean
Description
Sets the settings for the account modules.Arguments
Name | Type | Description | Default |
---|---|---|---|
$settings | array | list of module setting array(name => value) |
Return value
Type | Description |
---|---|
boolean | true if $settings has correct format |
set_scriptPath( string $value, ) : boolean
Description
Sets the path to the external scriptArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new script path |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
set_scriptRights( string $chmod, ) : boolean
Description
Sets the rights for the home directory.Arguments
Name | Type | Description | Default |
---|---|---|---|
$chmod | string | the rights |
Return value
Type | Description |
---|---|
boolean | true if values has correct format |
set_scriptServers( string $value, ) : boolean
Description
Sets the servers of the external scriptArguments
Name | Type | Description | Default |
---|---|---|---|
$value | string | new script servers |
Return value
Type | Description |
---|---|
boolean | true if $value has correct format |
Properties
$Admins, $Passwd, $ServerURL, $accessLevel, $activeTypes, $cachetimeout, $defaultLanguage, $file, $httpAuthentication, $lamProMailFrom, $lamProMailIsHTML, $lamProMailReplyTo, $lamProMailSubject, $lamProMailText, $loginMethod, $loginSearchDN, $loginSearchFilter, $loginSearchPassword, $loginSearchSuffix, $moduleSettings, $scriptPath, $scriptRights, $scriptServer, $searchLimit, $settings, $toolSettings, $treesuffix, $typeSettings, $useTLS,private $scriptPath =
Path to external lamdaemon script on server where it is executedThis is used for managing quota and home directories. optional setting, may not be defined
private $scriptServer =
Servers where lamdaemon script is executedThis is used for managing quota and home directories. optional setting, may not be defined
private $settings = array("ServerURL", "useTLS", "Passwd", "Admins", "treesuffix", "defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout", "modules", "activeTypes", "types", "tools", "accessLevel", 'loginMethod', 'loginSearchSuffix', 'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailReplyTo', 'lamProMailSubject', 'lamProMailText', 'lamProMailIsHTML', 'httpAuthentication', 'loginSearchDN', 'loginSearchPassword')
List of all settings in config fileLAMCfgMain
Description
This class manages config.cfg.Methods
__construct, checkPassword, deleteSSLCaCert, getInternalSSLCaCertFileName, getSSLCaCertPath, getSSLCaCertTempFileName, getSSLCaCertificateContent, getSSLCaCertificates, hashPassword, isConfigFileExisting, isWritable, reload, save, setPassword, splitSSLCaCertificateContent, uploadSSLCaCert,__construct( ) : n/a
Description
Loads preferences from config fileReturn value
Type | Description |
---|---|
n/a | n/a |
checkPassword( String $password, ) : boolean
Description
Checks if the given password matches.Arguments
Name | Type | Description | Default |
---|---|---|---|
$password | String | password |
Return value
Type | Description |
---|---|
boolean | true, if password matches |
deleteSSLCaCert( int $index = null, ) : n/a
Description
Marks a single or all SSL CA certificate files for deletion.The changes take effect on save().
Arguments
Name | Type | Description | Default |
---|---|---|---|
$index | int | certificate index, null deletes all certificates (default: null) |
null |
Return value
Type | Description |
---|---|
n/a | n/a |
getInternalSSLCaCertFileName( ) : String
Description
Returns the file name that will be used internally to store the CA file.Return value
Type | Description |
---|---|
String | file name |
getSSLCaCertPath( ) : String
Description
Returns the path to the SSL CA certificate file that overrides the system certificates.Return value
Type | Description |
---|---|
String | path to certificate file or null if certificate is not overridden |
getSSLCaCertTempFileName( ) : String
Description
Returns the name of a temporary file in tmp that contains the SSL certificate.The file contains either the stored data in serverCerts or the uploaded data.
Return value
Type | Description |
---|---|
String | file name or null if no certificate was set |
getSSLCaCertificateContent( ) : String
Description
Returns the content of the certificate file or uploaded data.Return value
Type | Description |
---|---|
String | null or certificate content |
getSSLCaCertificates( ) : array
Description
Returns a list of all CA certificates.Return value
Type | Description |
---|---|
array | list of certificates as output of openssl_x509_parse() |
hashPassword( String $password, String $salt, ) : String
Description
Returns the hashed password.Arguments
Name | Type | Description | Default |
---|---|---|---|
$password | String | password |
|
$salt | String | salt |
Return value
Type | Description |
---|---|
String | hash value |
isConfigFileExisting( ) : boolean
Description
Returns if the configuration file is existing.Return value
Type | Description |
---|---|
boolean | exists |
isWritable( ) : boolean
Description
Returns if the configuration file is writable.Return value
Type | Description |
---|---|
boolean | writable |
reload( ) : boolean
Description
Reloads preferences from config file config.cfgReturn value
Type | Description |
---|---|
boolean | true if file was readable |
save( ) : n/a
Description
Saves preferences to config file config.cfgReturn value
Type | Description |
---|---|
n/a | n/a |
setPassword( String $password, ) : n/a
Description
Sets a new config password.Arguments
Name | Type | Description | Default |
---|---|---|---|
$password | String | new password |
Return value
Type | Description |
---|---|
n/a | n/a |