summaryrefslogtreecommitdiffstats
path: root/inc/util.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2024-05-27 15:37:55 +0200
committerSimon Rettberg2024-05-27 15:37:55 +0200
commit43ddb14693e4a4830f471dd7c90f6257d95b7b29 (patch)
tree8c960b53e0f7ba1c660d16abf8bf044411b96080 /inc/util.inc.php
parentMerge branch 'master' of git.openslx.org:bwlp/bwlp-webadmin (diff)
downloadbwlp-webadmin-master.tar.gz
bwlp-webadmin-master.tar.xz
bwlp-webadmin-master.zip
Add support for client login via QRCodeHEADmaster
Diffstat (limited to 'inc/util.inc.php')
-rw-r--r--inc/util.inc.php18
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;
+ }
+
}