diff --git a/library/Businessprocess/Storage/LegacyStorage.php b/library/Businessprocess/Storage/LegacyStorage.php index e7c0a3a..8d009cc 100644 --- a/library/Businessprocess/Storage/LegacyStorage.php +++ b/library/Businessprocess/Storage/LegacyStorage.php @@ -60,6 +60,11 @@ class LegacyStorage extends Storage } /** + * All processes readable by the current user + * + * The returned array has the form => , sorted + * by title + * * @return array */ public function listProcesses() @@ -72,13 +77,43 @@ class LegacyStorage extends Storage continue; } - $files[$name] = $name; + $files[$name] = $meta->getExtendedTitle(); } - natsort($files); + natcasesort($files); return $files; } + /** + * All process names readable by the current user + * + * The returned array has the form => and is + * sorted + * + * @return array + */ + public function listProcessNames() + { + $files = array(); + + foreach ($this->listAllProcessNames() as $name) { + $meta = $this->loadMetadata($name); + if (! $meta->canRead()) { + continue; + } + + $files[$name] = $name; + } + + natcasesort($files); + return $files; + } + + /** + * All available process names, regardless of eventual restrictions + * + * @return array + */ public function listAllProcessNames() { $files = array(); @@ -94,7 +129,7 @@ class LegacyStorage extends Storage } } - natsort($files); + natcasesort($files); return $files; } diff --git a/library/Businessprocess/Web/Component/Dashboard.php b/library/Businessprocess/Web/Component/Dashboard.php index 8f8311a..698daec 100644 --- a/library/Businessprocess/Web/Component/Dashboard.php +++ b/library/Businessprocess/Web/Component/Dashboard.php @@ -37,7 +37,7 @@ class Dashboard extends BaseElement $this->auth = $auth; $this->storage = $storage; // TODO: Auth? - $processes = $storage->listProcesses(); + $processes = $storage->listProcessNames(); $this->add( HtmlTag::h1($this->translate('Welcome to your Business Process Overview')) );