summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/main.inc.php')
-rw-r--r--modules/main.inc.php74
1 files changed, 53 insertions, 21 deletions
diff --git a/modules/main.inc.php b/modules/main.inc.php
index 3f77d7b..c1382e6 100644
--- a/modules/main.inc.php
+++ b/modules/main.inc.php
@@ -11,30 +11,62 @@ class Page_Main extends Page
protected function doRender()
{
Render::addTemplate('main/_page');
- if (User::isLoggedIn()) {
- // Logged in user --
- if (User::getOrganization() !== false) {
- // Organization is known, show signup form
- if (User::isShibbolethAuth() && !User::isInDatabase()) {
- // User comes via Shibboleth and is not known yet
- $data = User::getData();
- $data['organization'] = User::getOrganizationName();
- Render::addTemplate('main/deploy', $data);
- } else if (User::isInDatabase()) {
- // User is known from DB at least
- Render::addTemplate('main/logged-in');
- }
- } else if (User::getRemoteOrganizationId() !== false) {
- // Organization is not known, see if we at least have an idea
- Message::addWarning('Ihre Hochschule/Einrichtung {{0}} ist leider nicht bekannt. Bitte kontaktieren Sie den Support.', User::getRemoteOrganizationId());
- } else {
- // No idea where the user is coming from
- Message::addError('Ihr IdP sendet leider keine Informationen über Ihre Hochschul-/Einrichtungszugehörigkeit');
- }
- } else {
+ if (!User::isLoggedIn()) {
// Guest
Render::addTemplate('main/guest');
+ return;
+ }
+ // Logged in user --
+ if (User::isLocalOnly()) {
+ // Local test account
+ $this->renderLocalAccount();
+ return;
+ }
+ if (!User::isShibbolethAuth()) {
+ // Should not be possible
+ Message::addError('Sie sind nicht korrekt authentifiziert. Bitte melden Sie sich erneut an.');
+ Session::delete();
+ return;
+ }
+ // --- Below here we know the user via shibboleth
+ if (User::isInDatabase()) {
+ // User is also in DB, so he signed up for the service
+ $this->renderShibbolethRegistered();
+ return;
}
+ // User is not in DB, so he might want so sign up for the service - see if conditions are met
+ if (User::getOrganization() !== false) {
+ // Organization is known, show signup form
+ $this->renderShibbolethUnregistered();
+ return;
+ }
+ // Nothing we can do here, show error message :-(
+ if (User::getRemoteOrganizationId() !== false) {
+ // Organization is not known, see if we at least have an idea
+ Message::addWarning('Ihre Hochschule/Einrichtung {{0}} ist leider nicht bekannt. Bitte kontaktieren Sie den Support.', User::getRemoteOrganizationId());
+ } else {
+ // No idea where the user is coming from
+ Message::addError('Ihr IdP sendet leider keine Informationen über Ihre Hochschul-/Einrichtungszugehörigkeit');
+ }
+ }
+
+ private function renderShibbolethRegistered()
+ {
+ Render::addTemplate('main/logged-in');
+ }
+
+ private function renderShibbolethUnregistered()
+ {
+ $data = User::getData();
+ $data['organization'] = User::getOrganizationName();
+ Render::addTemplate('main/deploy', $data);
+ }
+
+ private function renderLocalAccount()
+ {
+ $data = User::getData();
+ $data['organization'] = User::getOrganizationName();
+ Render::addTemplate('main/logged-in-testacc', $data);
}
}