You are here

public function LdapAuthorizationConsumerAbstract::filterOffPastAuthorizationRecords in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/LdapAuthorizationConsumerAbstract.class.php \LdapAuthorizationConsumerAbstract::filterOffPastAuthorizationRecords()

This is a function to clear off.

2 calls to LdapAuthorizationConsumerAbstract::filterOffPastAuthorizationRecords()
LdapAuthorizationConsumerAbstract::authorizationGrant in ldap_authorization/LdapAuthorizationConsumerAbstract.class.php
Grant authorizations to a user.
LdapAuthorizationConsumerAbstract::authorizationRevoke in ldap_authorization/LdapAuthorizationConsumerAbstract.class.php
Revoke authorizations to a user.

File

ldap_authorization/LdapAuthorizationConsumerAbstract.class.php, line 268
Abstract class to represent an ldap_authorization consumer behavior such as drupal_role, og_group, etc. each authorization comsumer will extend this class with its own class named LdapAuthorizationConsumer<consumer type> such as…

Class

LdapAuthorizationConsumerAbstract

Code

public function filterOffPastAuthorizationRecords(&$user, &$user_auth_data, $time = NULL) {
  if ($time != NULL || variable_get('ldap_help_user_data_clear', 0)) {
    $clear_time = $time ? $time : variable_get('ldap_help_user_data_clear_set_date', 0);
    if ($clear_time > 0 && $clear_time < time()) {
      foreach ($user_auth_data as $consumer_id => $entry) {
        if ($entry['date_granted'] < $clear_time) {
          unset($user_auth_data[$consumer_id]);
          if (isset($user->data['ldap_authorizations'][$this->consumerType][$consumer_id])) {
            unset($user->data['ldap_authorizations'][$this->consumerType][$consumer_id]);
          }
        }
      }
    }
  }
}