From 0072990f4485187afec0df3cd7c43a8efcfe2f89 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Mon, 15 May 2023 18:14:46 -0400 Subject: [PATCH] cas attribute for discussion moderators so we can give them access to the board forum before others --- docs/fsf-drupal-auth.md | 3 +++ lib/Auth/Source/FSFDrupalAuth.php | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/fsf-drupal-auth.md b/docs/fsf-drupal-auth.md index fdc1887..7491059 100644 --- a/docs/fsf-drupal-auth.md +++ b/docs/fsf-drupal-auth.md @@ -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 diff --git a/lib/Auth/Source/FSFDrupalAuth.php b/lib/Auth/Source/FSFDrupalAuth.php index 935ada4..9e2358e 100644 --- a/lib/Auth/Source/FSFDrupalAuth.php +++ b/lib/Auth/Source/FSFDrupalAuth.php @@ -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 // -- 2.25.1