cas attribute for discussion moderators
authorAndrew Engelbrecht <andrew@fsf.org>
Mon, 15 May 2023 22:14:46 +0000 (18:14 -0400)
committerroot <root@login0d.fsf.org>
Mon, 15 May 2023 22:14:46 +0000 (18:14 -0400)
so we can give them access to the board forum before others

docs/fsf-drupal-auth.md
lib/Auth/Source/FSFDrupalAuth.php

index fdc1887255815395b1bf5f84875c42c56db36b26..7491059bb86491f434dc98947e00782f9cc17af8 100644 (file)
@@ -45,6 +45,9 @@ SQL queries in `config/authsources.php` should be something like the following:
         'discussion_process_adhoc_access_group_id' => '1786',
         'discussion_process_adhoc_no_access_group_id' => '1787',
         'discussion_process_donation_amount' => '120',
+
+        'discussion_moderator_access_group_id' => '1788',
+
     ],
 
 ## License
index 935ada49d8b873e9cbd026db4285b2cf48d6bde6..9e2358ea8b3b58b2dcac2a314b9383b9cade9afc 100644 (file)
@@ -74,6 +74,8 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase
     private $discussion_process_adhoc_no_access_group_id;
     private $discussion_process_donation_amount;
 
+    private $discussion_process_moderator_access_group_id;
+
     /**
      * Constructor for this authentication source.
      *
@@ -543,6 +545,21 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase
                $attributes['discussion_process'] = ['false'];
        }
 
+       //
+       // discussion forum moderator early access
+       //
+
+       $adhoc_params       = ['adhoc_access_group_id' => intval($this->discussion_moderator_access_group_id)];
+
+       if ($compare_res($donation_query('query_discussion_process_adhoc', $adhoc_params), 1)) {
+               Logger::debug('fsfdrupalauth:'.$this->authId.': In adhoc list of moderators for board discussion forum');
+               $attributes['discussion_moderator'] = ['true'];
+
+       } else {
+               Logger::debug('fsfdrupalauth:'.$this->authId.': Not in adhoc list of moderators for board discussion forum');
+               $attributes['discussion_moderator'] = ['false'];
+       }
+
         //
         // aggregate attribute
         //