use can_manage() functions to generate module lists
This commit is contained in:
parent
6522fa596b
commit
915a39a85f
|
@ -152,22 +152,20 @@ function check_module_conflicts($selected, $deps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns an array with all available user module names
|
// returns an array with all available user module names
|
||||||
|
// $scope = suer, group, host, ....
|
||||||
function getAvailableModules($scope) {
|
function getAvailableModules($scope) {
|
||||||
// scope = suer, group, host, ....
|
|
||||||
// get module names.
|
// get module names.
|
||||||
$dir = opendir('../../lib/modules');
|
$dir = opendir('../../lib/modules');
|
||||||
while ($entry = readdir($dir))
|
while ($entry = readdir($dir))
|
||||||
if (is_file('../../lib/modules/'.$entry)) {
|
if (is_file('../../lib/modules/'.$entry)) {
|
||||||
$entry = substr($entry, 0, strpos($entry, '.'));
|
$entry = substr($entry, 0, strpos($entry, '.'));
|
||||||
$eval = '$module = '.$entry."::get_dependencies(".$scope.");";
|
if (call_user_func(array($entry, "can_manage"), $scope)) $return[] = $entry;
|
||||||
eval ($eval);
|
}
|
||||||
if ($module != -1) $return[] = $entry;
|
|
||||||
}
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $scope = user, group, host, ...
|
||||||
function getProfileOptions($scope, $post=false) {
|
function getProfileOptions($scope, $post=false) {
|
||||||
// type = user, group, host, ...
|
|
||||||
if (!isset($_SESSION['profile_account'])) {
|
if (!isset($_SESSION['profile_account'])) {
|
||||||
// create new object
|
// create new object
|
||||||
$_SESSION['profile_account'] = new accountContainer($scope, 'profile_account');
|
$_SESSION['profile_account'] = new accountContainer($scope, 'profile_account');
|
||||||
|
|
Loading…
Reference in New Issue