diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index e6a24a476..27248d4fa 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -399,22 +399,19 @@ class PMPluginRegistry } /** - * get status plugin in the singleton + * Get status plugin in the singleton * - * @param unknown_type $sNamespace + * @param string $name Plugin name + * + * return mixed Return a string with status plugin, 0 otherwise */ - public function getStatusPlugin ($sNamespace) + public function getStatusPlugin($name) { - foreach ($this->_aPluginDetails as $namespace => $detail) { - if ($sNamespace == $namespace) { - if ($this->_aPluginDetails[$sNamespace]->enabled) { - return 'enabled'; - } else { - return 'disabled'; - } - } + try { + return (isset($this->_aPluginDetails[$name]))? (($this->_aPluginDetails[$name]->enabled)? "enabled" : "disabled") : 0; + } catch (Excepton $e) { + throw $e; } - return 0; } /** diff --git a/workflow/engine/methods/authSources/authSources_Ajax.php b/workflow/engine/methods/authSources/authSources_Ajax.php index 5e2dbb57b..edf936350 100755 --- a/workflow/engine/methods/authSources/authSources_Ajax.php +++ b/workflow/engine/methods/authSources/authSources_Ajax.php @@ -149,16 +149,30 @@ try { } break; case 'authSourcesNew': + $pluginRegistry = &PMPluginRegistry::getSingleton(); + $arr = Array (); $oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP ); - $aAuthSourceTypes = array (); + while ($sObject = $oDirectory->read()) { if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) { if (is_file( PATH_RBAC . 'plugins' . PATH_SEP . $sObject )) { - $sType = trim( str_replace( 'class.', '', str_replace( '.php', '', $sObject ) ) ); - $aAuthSourceTypes['sType'] = $sType; - $aAuthSourceTypes['sLabel'] = $sType; - $arr[] = $aAuthSourceTypes; + $sType = trim(str_replace(array("class.", ".php"), "", $sObject)); + + $statusPlugin = $pluginRegistry->getStatusPlugin($sType); + $flagAdd = false; + + if (preg_match("/^(?:enabled|disabled)$/", $statusPlugin)) { + if ($statusPlugin == "enabled") { + $flagAdd = true; + } + } else { + $flagAdd = true; + } + + if ($flagAdd) { + $arr[] = array("sType" => $sType, "sLabel" => $sType); + } } } }