allow to hide self service only modules

This commit is contained in:
Roland Gruber 2012-07-22 18:10:44 +00:00
parent 7cc3a97be9
commit 0893d176fe
4 changed files with 32 additions and 5 deletions

View File

@ -10,6 +10,7 @@
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
@ -27,8 +28,16 @@ This is a list of API changes for all LAM releases.
<br> <br>
<h2>3.8 -&gt; 3.9</h2>Module interface:<br>
<ul>
<li><span style="font-weight: bold;">supportsAdminInterface()</span>: Can be used mark modules that only support the self service.<br>
</li>
</ul>
<br>
<h2>3.7 -&gt; 3.8<br> <h2>3.7 -&gt; 3.8<br>
</h2>Type interface:<br> </h2>
Type interface:<br>
<ul> <ul>
<li><span style="font-weight: bold;">getTitleBarTitle()/getTitleBarSubtitle(): </span>changed <li><span style="font-weight: bold;">getTitleBarTitle()/getTitleBarSubtitle(): </span>changed
parameter from attribute array to accountContainer object. parameter from attribute array to accountContainer object.

View File

@ -1409,6 +1409,18 @@ abstract class baseModule {
// modules that use AJAX need to implement this function // modules that use AJAX need to implement this function
} }
/**
* Specifies if this module supports the LAM admin interface.
* The LAM admin interface are the pages that allow to manage e.g. users and groups.
* In contrast there is also the LAM self service interface. Most modules support
* the admin interface.
*
* @return boolean support admin interface
*/
public static function supportsAdminInterface() {
return true;
}
// helper functions // helper functions

View File

@ -247,9 +247,10 @@ function check_module_conflicts($selected, $deps) {
* Returns an array with all available user module names * Returns an array with all available user module names
* *
* @param string $scope account type (user, group, host) * @param string $scope account type (user, group, host)
* @param boolean $mustSupportAdminInterface module must support LAM admin interface (default: false)
* @return array list of possible modules * @return array list of possible modules
*/ */
function getAvailableModules($scope) { function getAvailableModules($scope, $mustSupportAdminInterface = false) {
$dirname = substr(__FILE__, 0, strlen(__FILE__) - 12) . "/modules"; $dirname = substr(__FILE__, 0, strlen(__FILE__) - 12) . "/modules";
$dir = dir($dirname); $dir = dir($dirname);
$return = array(); $return = array();
@ -258,7 +259,12 @@ function getAvailableModules($scope) {
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($dirname . '/'.$entry)) { if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($dirname . '/'.$entry)) {
$entry = substr($entry, 0, strpos($entry, '.')); $entry = substr($entry, 0, strpos($entry, '.'));
$temp = new $entry($scope); $temp = new $entry($scope);
if ($temp->can_manage()) $return[] = $entry; if ($mustSupportAdminInterface && !$entry::supportsAdminInterface()) {
continue;
}
if ($temp->can_manage()) {
$return[] = $entry;
}
} }
return $return; return $return;
} }

View File

@ -237,7 +237,7 @@ function config_showAccountModules($scope, $title, &$container) {
$conf = &$_SESSION['conf_config']; $conf = &$_SESSION['conf_config'];
$typeSettings = $conf->get_typeSettings(); $typeSettings = $conf->get_typeSettings();
// account modules // account modules
$available = getAvailableModules($scope); $available = getAvailableModules($scope, true);
$selected = $typeSettings['modules_' . $scope]; $selected = $typeSettings['modules_' . $scope];
if (isset($selected) && ($selected != '')) { if (isset($selected) && ($selected != '')) {
$selected = explode(',', $selected); $selected = explode(',', $selected);
@ -332,7 +332,7 @@ function checkInput() {
$accountTypes = $conf->get_ActiveTypes(); $accountTypes = $conf->get_ActiveTypes();
for ($t = 0; $t < sizeof($accountTypes); $t++) { for ($t = 0; $t < sizeof($accountTypes); $t++) {
$scope = $accountTypes[$t]; $scope = $accountTypes[$t];
$available = getAvailableModules($scope); $available = getAvailableModules($scope, true);
$selected_temp = $typeSettings['modules_' . $scope]; $selected_temp = $typeSettings['modules_' . $scope];
if (isset($selected_temp)) $selected_temp = explode(',', $selected_temp); if (isset($selected_temp)) $selected_temp = explode(',', $selected_temp);
$selected = array(); $selected = array();