// custom fsf authentication source wrapped by ratelimit auth source
'fsfdrupalauth:FSFDrupalAuth',
- 'member_long_term_date' => '2022-01-01',
+ 'nomination_process_date' => '2022-01-01',
'dsn' => 'mysql:host=example.com;port=3306;dbname=drupal',
'username' => '$DB_USERNAME',
'password' => '$DB_PASSWORD',
// don't filter with 'and c.is_test = 0' because these may be useful for FSF staff
'query_membership' => "select c.status_id from drupal.users a inner join civicrm.civicrm_uf_match b on a.uid=b.uf_id inner join civicrm.civicrm_membership c on b.contact_id=c.contact_id inner join civicrm.civicrm_contact d on c.contact_id=d.id where a.status = 1 and d.is_deleted = 0 and c.status_id is not NULL and a.name = :username and (c.status_id = 1 or c.status_id = 2 or c.status_id = 3 or c.status_id = 4) order by c.status_id limit 10;",
'query_staff' => "select a.name as is_fsf_staff from drupal.users a inner join civicrm.civicrm_uf_match b on a.uid=b.uf_id inner join civicrm.civicrm_contact c on b.contact_id=c.id inner join civicrm.civicrm_relationship d on c.id=d.contact_id_a where a.name=:username and a.status=1 and c.is_deleted=0 and d.relationship_type_id=4 and d.contact_id_b=FOOBAR and d.is_active=1 and (d.end_date>NOW() or d.end_date is NULL) limit 1;",
- 'query_membership_long_term' => "select c.join_date from drupal.users a inner join civicrm.civicrm_uf_match b on a.uid=b.uf_id inner join civicrm.civicrm_membership c on b.contact_id=c.contact_id inner join civicrm.civicrm_contact d on c.contact_id=d.id where a.name = :username and c.status_id is not NULL and (c.status_id = 1 or c.status_id = 2 or c.status_id = 3 or c.status_id = 4) and c.join_date <= :member_long_term_date order by c.join_date limit 1;",
+ 'query_nomination_process' => "select c.join_date from drupal.users a inner join civicrm.civicrm_uf_match b on a.uid=b.uf_id inner join civicrm.civicrm_membership c on b.contact_id=c.contact_id inner join civicrm.civicrm_contact d on c.contact_id=d.id where a.name = :username and c.status_id is not NULL and (c.status_id = 1 or c.status_id = 2 or c.status_id = 3 or c.status_id = 4) and c.join_date <= :nomination_process_date order by c.join_date limit 1;",
],
private $query_main;
private $query_membership;
private $query_staff;
- private $query_membership_long_term;
+ private $query_nomination_process;
/**
- * Date for determining whether someone is a long-term member or not
+ * Date for determining whether someone can participate in board nomination
+ * process
*/
- private $member_long_term_date;
+ private $nomination_process_date;
/**
* Constructor for this authentication source.
parent::__construct($info, $config);
// Make sure that all required parameters are present.
- foreach (['dsn', 'username', 'password', 'query_main', 'query_membership', 'query_staff', 'query_membership_long_term', 'member_long_term_date'] as $param) {
+ foreach (['dsn', 'username', 'password', 'query_main', 'query_membership', 'query_staff', 'query_nomination_process', 'nomination_process_date'] as $param) {
if (!array_key_exists($param, $config)) {
throw new Exception('Missing required attribute \''.$param.
'\' for authentication source '.$this->authId);
$this->query_main = $config['query_main'];
$this->query_membership = $config['query_membership'];
$this->query_staff = $config['query_staff'];
- $this->query_membership_long_term = $config['query_membership_long_term'];
- $this->member_long_term_date = $config['member_long_term_date'];
+ $this->query_nomination_process = $config['query_nomination_process'];
+ $this->nomination_process_date = $config['nomination_process_date'];
if (isset($config['options'])) {
$this->options = $config['options'];
}
// query on first membership join date
//
- $membership_date_data = $this->query_db('query_membership_long_term', ['username' => $username, 'member_long_term_date' => $member_long_term_date]);
+ $membership_date_data = $this->query_db('query_nomination_process', ['username' => $username, 'nomination_process_date' => $nomination_process_date]);
if (count($membership_date_data) === 0) {
// No rows returned - no old membership start
': No rows in result set. May only be a short term member.');
}
- $attributes['long_term_member'] = ['false'];
+ $attributes['nomination_process'] = ['false'];
foreach ($membership_date_data as $row) {
foreach ($row as $key => $value) {
if ($value === null) {
continue;
} elseif ($attributes['is_member'][0] == 'true') {
- $attributes['long_term_member'] = ['true'];
+ $attributes['nomination_process'] = ['true'];
}
}
}