summaryrefslogtreecommitdiffstats
path: root/inc/util.inc.php
diff options
context:
space:
mode:
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;
+ }
+
}