You are here

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

Same name and namespace in other branches
  1. 7.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 230
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
@file

Code

public function filterOffPastAuthorizationRecords(&$user, &$user_auth_data, $time = NULL) {
  if ($time != NULL || config('ldap_help.settings')
    ->get('user_data_clear')) {
    $clear_time = $time ? $time : config('ldap_help.settings')
      ->get('user_data_clear_set_date');
    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]);
          }
        }
      }
    }
  }
}