allow staff to access board forum
authorAndrew Engelbrecht <andrew@fsf.org>
Wed, 26 Apr 2023 17:05:42 +0000 (13:05 -0400)
committerroot <root@login0d.fsf.org>
Wed, 26 Apr 2023 17:05:42 +0000 (13:05 -0400)
lib/Auth/Source/FSFDrupalAuth.php

index 1e80d51358e2cfc37596cf61955aeba65c7ea5e8..a44f5a8f47715eaf13b3a2ebc18aab83ea816b64 100644 (file)
@@ -291,6 +291,36 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase
      */
     private function add_more_attributes(&$attributes, $username) {
 
+        //
+        // query on staff
+        //
+
+        $staff_data = $this->query_db('query_staff', ['username' => $username, 'fsf_org_id' => $this->fsf_org_id]);
+
+        if (count($staff_data) === 0) {
+            // No rows returned - invalid username
+            Logger::debug('fsfdrupalauth:'.$this->authId.
+                ': No rows in result set. Probably not FSF staff.');
+        }
+
+        $attributes['is_fsf_staff'] = ['false'];
+
+        foreach ($staff_data as $row) {
+            foreach ($row as $key => $value) {
+
+                if ($value === null) {
+                    continue;
+                }
+                $value = (string) $value;
+
+                if (strtolower($value) === strtolower($username)) {
+                    // they are staff
+                    $attributes['is_fsf_staff'] = ['true'];
+                    break;
+                }
+            }
+        }
+
         //
         // query on membership
         //
@@ -496,6 +526,9 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase
        } elseif ($compare_res($donation_query('query_discussion_process_adhoc', $adhoc_params), 1)) {
                $attributes['discussion_process'] = ['true'];
 
+       } elseif ($attributes['is_fsf_staff'] == ['true']) {
+               $attributes['discussion_process'] = ['true'];
+
        } elseif ($attributes['is_member'] != ['true']) {
                Logger::debug('fsfdrupalauth:'.$this->authId.
                        ': Not eligible for board nominee discussion process.');
@@ -512,36 +545,6 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase
                $attributes['discussion_process'] = ['false'];
        }
 
-        //
-        // query on staff
-        //
-
-        $staff_data = $this->query_db('query_staff', ['username' => $username, 'fsf_org_id' => $this->fsf_org_id]);
-
-        if (count($staff_data) === 0) {
-            // No rows returned - invalid username
-            Logger::debug('fsfdrupalauth:'.$this->authId.
-                ': No rows in result set. Probably not FSF staff.');
-        }
-
-        $attributes['is_fsf_staff'] = ['false'];
-
-        foreach ($staff_data as $row) {
-            foreach ($row as $key => $value) {
-
-                if ($value === null) {
-                    continue;
-                }
-                $value = (string) $value;
-
-                if (strtolower($value) === strtolower($username)) {
-                    // they are staff
-                    $attributes['is_fsf_staff'] = ['true'];
-                    break;
-                }
-            }
-        }
-
         //
         // aggregate attribute
         //