diff options
author | Simon Rettberg | 2024-05-27 15:37:55 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-05-27 15:37:55 +0200 |
commit | 43ddb14693e4a4830f471dd7c90f6257d95b7b29 (patch) | |
tree | 8c960b53e0f7ba1c660d16abf8bf044411b96080 /inc/util.inc.php | |
parent | Merge branch 'master' of git.openslx.org:bwlp/bwlp-webadmin (diff) | |
download | bwlp-webadmin-master.tar.gz bwlp-webadmin-master.tar.xz bwlp-webadmin-master.zip |
Diffstat (limited to 'inc/util.inc.php')
-rw-r--r-- | inc/util.inc.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/inc/util.inc.php b/inc/util.inc.php index 0e06e6a..4904588 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -286,4 +286,22 @@ SADFACE; exit(0); } + public static function getRole(?string $debugKey = null): string + { + if (strpos(";{$_SERVER['entitlement']};", CONFIG_ENTITLEMENT) !== false) { + $role = 'TUTOR'; + } else if (strpos(";{$_SERVER[CONFIG_SCOPED_AFFILIATION]};", ';employee@') !== false + || strpos(";{$_SERVER[CONFIG_SCOPED_AFFILIATION]};", ';staff@') !== false + || strpos(";{$_SERVER[CONFIG_SCOPED_AFFILIATION]};", ';faculty@') !== false) { + $role = 'TUTOR'; + } else { + if ($debugKey !== null) { + file_put_contents('/tmp/shib-student-' . $debugKey . '-' + . time() . '-' . $_SERVER['REMOTE_ADDR'] . '.txt', print_r($_SERVER, true)); + } + $role = 'STUDENT'; + } + return $role; + } + } |