Registry
in package
A test replacement for Horde_Registry.
Tags
Table of Contents
- $hordeInit : bool
- A flag that is set once the basic horde application has been minimally configured.
- $app : string
- The current application.
- $configObjects : array<string|int, mixed>
- List of pre-configured configuration objects.
- $user : string
- The currrent user.
- __construct() : mixed
- Constructor.
- convertUsername() : string
- Converts an authentication username to a unique Horde username.
- get() : string
- Return the requested configuration parameter for the specified application. If no application is specified, the value of the current application is used. However, if the parameter is not present for that application, the Horde-wide value is used instead.
- getApp() : string
- Return the current application - the app at the top of the application stack.
- getAuth() : mixed
- Returns the currently logged in user, if there is one.
- hasInterface() : mixed
- Determine if an interface is implemented by an active application.
- isAdmin() : bool
- Is a user an administrator?
- listAPIs() : array<string|int, mixed>
- Returns all available registry APIs.
- loadConfigFile() : Loadconfig
- Load a configuration file from a Horde application's config directory.
- remoteHost() : object
- Returns information about the remote host.
- setConfigFile() : mixed
- Assigns a (pre-configured) Loadconfig object.
Properties
$hordeInit
A flag that is set once the basic horde application has been minimally configured.
public
bool
$hordeInit
= false
$app
The current application.
protected
string
$app
$configObjects
List of pre-configured configuration objects.
protected
array<string|int, mixed>
$configObjects
= []
$user
The currrent user.
protected
string
$user
Methods
__construct()
Constructor.
public
__construct(string $user, string $app) : mixed
Parameters
- $user : string
-
The current user.
- $app : string
-
The current application.
Return values
mixed —convertUsername()
Converts an authentication username to a unique Horde username.
public
convertUsername(string $userId, bool $toHorde) : string
Parameters
- $userId : string
-
The username to convert.
- $toHorde : bool
-
If true, convert to a Horde username. If false, convert to the auth username.
Tags
Return values
string —The converted username.
get()
Return the requested configuration parameter for the specified application. If no application is specified, the value of the current application is used. However, if the parameter is not present for that application, the Horde-wide value is used instead.
public
get(string $parameter[, string $app = null ]) : string
If that is not present, we return null.
Parameters
- $parameter : string
-
The configuration value to retrieve.
- $app : string = null
-
The application to get the value for.
Return values
string —The requested parameter, or null if it is not set.
getApp()
Return the current application - the app at the top of the application stack.
public
getApp() : string
Return values
string —The current application.
getAuth()
Returns the currently logged in user, if there is one.
public
getAuth([string $format = null ]) : mixed
Parameters
- $format : string = null
-
The return format, defaults to the unique Horde ID. Alternative formats:
bare - Horde ID without any domain information. EXAMPLE: foo@example.com would be returned as 'foo'. domain: Domain of the Horde ID. EXAMPLE: foo@example.com would be returned as 'example.com'. original: The username used to originally login to Horde.
Return values
mixed —The user ID or false if no user is logged in.
hasInterface()
Determine if an interface is implemented by an active application.
public
hasInterface(string $interface) : mixed
Parameters
- $interface : string
-
The interface to check for.
Return values
mixed —The application implementing $interface if we have it, false if the interface is not implemented.
isAdmin()
Is a user an administrator?
public
isAdmin([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
-
Options:
'permission' - (string) Allow users with this permission admin access in the current context. 'permlevel' - (integer) The level of permissions to check for. Defaults to Horde_Perms::EDIT. 'user' - (string) The user to check. Defaults to self::getAuth().
Return values
bool —Whether or not this is an admin user.
listAPIs()
Returns all available registry APIs.
public
listAPIs() : array<string|int, mixed>
Return values
array<string|int, mixed> —The API list.
loadConfigFile()
Load a configuration file from a Horde application's config directory.
public
loadConfigFile(string $conf_file[, mixed $vars = null ][, string $app = null ]) : Loadconfig
This call is cached (a config file is only loaded once, regardless of the $vars value).
Parameters
- $conf_file : string
-
Configuration file name.
- $vars : mixed = null
-
List of config variables to load.
- $app : string = null
-
Application.
Tags
Return values
Loadconfig —The config object.
remoteHost()
Returns information about the remote host.
public
remoteHost() : object
Return values
object —An object with the following properties:
- addr: (string) Remote IP address. - host: (string) Remote hostname (if resolvable; otherwise, this value is identical to 'addr'). - proxy: (boolean) True if this user is connecting through a proxy.
setConfigFile()
Assigns a (pre-configured) Loadconfig object.
public
setConfigFile(object $loadconfig, string $conf_file[, mixed $vars = null ][, string $app = null ]) : mixed
This object will be returned by loadConfig(), if the same parameters are used.
Parameters
- $loadconfig : object
-
Configuration object.
- $conf_file : string
-
Configuration file name.
- $vars : mixed = null
-
List of config variables to load.
- $app : string = null
-
Application.