diff --git a/app/resources/locales/en_US/information.po b/app/resources/locales/en_US/information.po index 841a93e7b..e5183c44e 100644 --- a/app/resources/locales/en_US/information.po +++ b/app/resources/locales/en_US/information.po @@ -36,6 +36,12 @@ msgstr "You are not an active member in any collaboration. If your request for e msgid "cos.select" msgstr "Please select the collaboration (CO) you wish to manage." +msgid "cmp.config.notice" +msgstr "Platform-wide configurations are available in the COmanage CO." + +msgid "cmp.co.notice" +msgstr "This is the COmanage CO, which is used for platform wide configurations." + msgid "entity.id" msgstr "ID: {0}" diff --git a/app/resources/locales/en_US/menu.po b/app/resources/locales/en_US/menu.po index 72149952c..967082c80 100644 --- a/app/resources/locales/en_US/menu.po +++ b/app/resources/locales/en_US/menu.po @@ -42,6 +42,9 @@ msgstr "Attributes" msgid "co.configuration" msgstr "Configuration" +msgid "co.configuration.desc" +msgstr "Configuration for the current CO" + msgid "co.configuration.short" msgstr "Config" @@ -58,16 +61,13 @@ msgid "co.configuration.panel.personalization.desc" msgstr "Dashboards, custom text, and theming" msgid "co.configuration.panel.platform" -msgstr "Platform-Wide Settings" +msgstr "Platform-Wide Configuration" msgid "co.configuration.panel.platform.desc" msgstr "These configurations are found only in the COmanage CO" -msgid "co.configuration.panel.setup" -msgstr "CO Setup" - -msgid "co.configuration.panel.setup.desc" -msgstr "Settings for the current CO" +msgid "co.configuration.title" +msgstr "CO Configuration" msgid "co.connections" msgstr "Connections" diff --git a/app/src/Controller/AppController.php b/app/src/Controller/AppController.php index d29da07e6..f8714ae4d 100644 --- a/app/src/Controller/AppController.php +++ b/app/src/Controller/AppController.php @@ -140,12 +140,16 @@ public function beforeRender(\Cake\Event\EventInterface $event) { $modelsName = $this->name; // Views can also inspect the request object to determine the current - // action, but it seems slightly easier to do it once here. + // controller and action, but it seems slightly easier to do it once here. + $this->set('vv_controller', $this->request->getParam('controller')); $this->set('vv_action', $this->request->getParam('action')); if(isset($this->RegistryAuth)) { // Components might not be loaded on error, so check $this->set('vv_menu_permissions', $this->RegistryAuth->getMenuPermissions($this->getCOID())); + + // Provide the user's application roles to the views. + $this->set('vv_user_roles', $this->RegistryAuth->getApplicationUserRoles($this->getCOID())); } return parent::beforeRender($event); diff --git a/app/src/Controller/Component/RegistryAuthComponent.php b/app/src/Controller/Component/RegistryAuthComponent.php index b59f0511a..c88f073b5 100644 --- a/app/src/Controller/Component/RegistryAuthComponent.php +++ b/app/src/Controller/Component/RegistryAuthComponent.php @@ -422,6 +422,32 @@ public function calculatePermissionsForView(string $action, ?int $id=null): arra return $this->calculatePermissions($id); } + /** + * Obtain the application role of the user for general use in the views + * + * @since COmanage Registry v5.0.0 + * @param int $coId Current CO ID, if known + * @return array $appRoles Array of roles + */ + + public function getApplicationUserRoles(?int $coId): array { + $appUserRoles = []; + + // True for platform administrator + $appUserRoles['platform'] = $this->isPlatformAdmin(); + + // True for administrator of the current CO + $appUserRoles['co'] = $this->isCoAdmin($coId); + + // TODO: add other application roles such as 'cou' and 'support' + // See: https://spaces.at.internet2.edu/display/COmanage/Registry+PE+Permissions + + // True if user is authenticated + $appUserRoles['authuser'] = $this->isAuthenticatedUser(); + + return $appUserRoles; + } + /** * Obtain the identifier of the currently authenticated user. * @@ -546,6 +572,17 @@ public function isApiUser(): bool { return $this->authenticatedApiUser; } + /** + * Determine if the current user is authenticated. + * + * @since COmanage Registry v5.0.0 + * @return bool True if the current user is authenticated + */ + + public function isAuthenticatedUser(): bool { + return !empty($this->authenticatedUser); + } + /** * Determine if the current user is a CO Administrator. * diff --git a/app/templates/Dashboards/configuration.php b/app/templates/Dashboards/configuration.php index e7ab5bec9..cd16fba0f 100644 --- a/app/templates/Dashboards/configuration.php +++ b/app/templates/Dashboards/configuration.php @@ -34,6 +34,8 @@
+

+ + +

+
+ + Url->build([ + 'plugin' => null, + 'controller' => 'dashboards', + 'action' => 'configuration', + '?' => [ + 'co_id' => 1 + ]]), + $this->Url->build([ + 'plugin' => null, + 'controller' => 'dashboards', + 'action' => 'dashboard', + '?' => [ + 'co_id' => 1 + ]]) + ]; + ?> +
+ Alert->alert(__d('information','cmp.config.notice', $noticeUrls), 'information', true) ?> +
+ +
\ No newline at end of file diff --git a/app/templates/Dashboards/dashboard.php b/app/templates/Dashboards/dashboard.php index 500d807ba..70f1e2285 100644 --- a/app/templates/Dashboards/dashboard.php +++ b/app/templates/Dashboards/dashboard.php @@ -26,8 +26,16 @@ */ // XXX This is a placeholder + +// $flashArgs pass banner messages to the flash element container +$flashArgs = []; +if(!empty($banners)) { + $flashArgs['vv_banners'] = $banners; +} + ?>
+ element('flash', $flashArgs); ?>

\ No newline at end of file diff --git a/app/templates/element/menuPanel.php b/app/templates/element/menuPanel.php index 9ef29eda7..879cae8f1 100644 --- a/app/templates/element/menuPanel.php +++ b/app/templates/element/menuPanel.php @@ -324,8 +324,8 @@