diff --git a/app/resources/locales/en_US/information.po b/app/resources/locales/en_US/information.po index f129fe850..2cb458542 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 "Looking for platform-wide configurations? Those are found in the COmanage CO." + +msgid "cmp.welcome" +msgstr "The COmanage CO provides 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 60bdcfedc..707c4f366 100644 --- a/app/resources/locales/en_US/menu.po +++ b/app/resources/locales/en_US/menu.po @@ -66,6 +66,9 @@ msgstr "CO Setup" msgid "co.configuration.panel.setup.desc" msgstr "Settings for the current CO" +msgid "co.configuration.title.common" +msgstr "Common CO Settings" + msgid "co.connections" msgstr "Connections" diff --git a/app/src/Controller/AppController.php b/app/src/Controller/AppController.php index d29da07e6..a189d1de6 100644 --- a/app/src/Controller/AppController.php +++ b/app/src/Controller/AppController.php @@ -146,6 +146,9 @@ public function beforeRender(\Cake\Event\EventInterface $event) { 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..71a15017e 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 CO administrator + $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,20 @@ 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 { + if(!empty($this->getAuthenticatedUser())) { + return true; + } + return false; + } + /** * 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..5bfae097c 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/layout/default.php b/app/templates/layout/default.php index d804d47c6..8b31dbac9 100644 --- a/app/templates/layout/default.php +++ b/app/templates/layout/default.php @@ -97,7 +97,6 @@
-
@@ -158,6 +157,21 @@ element('menuTop') ?>
+ + id == 1) && ($vv_action != 'select')): ?> + Url->build([ + 'plugin' => null, + 'controller' => 'dashboards', + 'action' => 'configuration', + '?' => [ + 'co_id' => 1 + ]]); + ?> +
+ +
+
diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 331af0b29..48ebf1436 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -919,6 +919,16 @@ ul.form-list li.alert-banner .co-alert { .top-filters-fields-date .duet-date__toggle { margin-top: -3px; } +/* PLATFORM NOTICE (for COmanage CO) */ +#platform-notice { + padding: 0.5em; + text-align: center; + border-bottom: 1px solid var(--cmg-color-bg-006); + background-color: var(--cmg-color-highlight-004); +} +#platform-notice a:hover { + text-decoration: underline; +} /* CO CONFIGURATION DASHBOARD */ .config-menu { list-style: none; @@ -938,6 +948,12 @@ ul.form-list li.alert-banner .co-alert { border-bottom: 1px solid var(--cmg-color-bg-006); padding-bottom: 1em; } +h2.config-subtitle { + font-size: 1.6em; +} +.config-platform-notice { + margin: 4em 0 -3em; +} /* INDEX ACTION COMMAND MENUS */ th.with-field-actions { padding-left: 2.75em;