Projet

Général

Profil

Révision bc175c27

Ajouté par Assos Assos il y a plus de 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConf.class.php
2 2

  
3 3
/**
4 4
 * @file
5
 * class to encapsulate an ldap entry to authorization consumer ids mapping configuration
5
 * Class to encapsulate an ldap entry to authorization consumer ids mapping configuration.
6 6
 *
7
 * this is the lightweight version of the class for use on logon etc.
7
 * This is the lightweight version of the class for use on logon etc.
8 8
 * the LdapAuthorizationConsumerConfAdmin extends this class and has save,
9 9
 * iterate, etc methods.
10
 *
11 10
 */
12 11

  
13 12
/**
14
 * LDAP Authorization Consumer Configuration
13
 * LDAP Authorization Consumer Configuration.
15 14
 */
16 15
class LdapAuthorizationConsumerConf {
17 16

  
......
44 43
  public $hasError = FALSE;
45 44
  public $errorName = NULL;
46 45

  
47

  
46
  /**
47
   *
48
   */
48 49
  public function clearError() {
49 50
    $this->hasError = FALSE;
50 51
    $this->errorMsg = NULL;
51 52
    $this->errorName = NULL;
52 53
  }
53
   /**
54
   * Constructor Method
54

  
55
  /**
56
   * Constructor Method.
55 57
   */
56
  function __construct(&$consumer, $_new = FALSE, $_sid = NULL) {
58
  public function __construct(&$consumer, $_new = FALSE, $_sid = NULL) {
57 59
    $this->consumer = $consumer;
58 60
    $this->consumerType = $consumer->consumerType;
59 61
    if ($_new) {
......
66 68
        watchdog('ldap_authorization', 'failed to load existing %consumer object', array('%consumer' => $consumer->consumerType), WATCHDOG_ERROR);
67 69
      }
68 70
    }
69
    // default value for deriveFromEntryAttrMatchingUserAttr set up this way for backward compatibility in 1.0 branch,
71
    // Default value for deriveFromEntryAttrMatchingUserAttr set up this way for backward compatibility in 1.0 branch,
70 72
    // make deriveFromEntryAttrMatchingUserAttr default to dn in 2.0 branch.
71 73
  }
72 74

  
75
  /**
76
   *
77
   */
73 78
  protected function loadFromDb() {
74 79
    if (module_exists('ctools')) {
75 80
      ctools_include('export');
......
83 88
    else {
84 89
      $select = db_select('ldap_authorization', 'ldap_authorization');
85 90
      $select->fields('ldap_authorization');
86
      $select->condition('ldap_authorization.consumer_type',  $this->consumerType);
91
      $select->condition('ldap_authorization.consumer_type', $this->consumerType);
87 92
      $server_record = $select->execute()->fetchObject();
88 93
    }
89 94

  
......
92 97
      return FALSE;
93 98
    }
94 99

  
95
    foreach ($this->field_to_properties_map() as $db_field_name => $property_name ) {
100
    foreach ($this->field_to_properties_map() as $db_field_name => $property_name) {
96 101
      if (isset($server_record->$db_field_name)) {
97 102
        if (in_array($db_field_name, $this->field_to_properties_serialized())) {
98 103
          $this->{$property_name} = unserialize($server_record->$db_field_name);
......
102 107
        }
103 108
      }
104 109
    }
105
    $this->numericConsumerConfId = isset($server_record->numeric_consumer_conf_id)? $server_record->numeric_consumer_conf_id : NULL;
110
    $this->numericConsumerConfId = isset($server_record->numeric_consumer_conf_id) ? $server_record->numeric_consumer_conf_id : NULL;
106 111
    $this->server = ldap_servers_get_servers($this->sid, NULL, TRUE);
107 112
    return TRUE;
108 113

  
109 114
  }
110 115

  
111
  // direct mapping of db to object properties
116
  /**
117
   * Direct mapping of db to object properties.
118
   */
112 119
  public static function field_to_properties_map() {
113 120
    return array(
114 121
      'sid' => 'sid',
......
127 134
    );
128 135
  }
129 136

  
137
  /**
138
   *
139
   */
130 140
  public static function field_to_properties_serialized() {
131 141
    return array('mappings');
132 142
  }
133 143

  
134 144
  /**
135
   * Destructor Method
145
   * Destructor Method.
136 146
   */
137
  function __destruct() {
147
  public function __destruct() {
138 148

  
139 149
  }
140 150

  
141 151
  protected $_sid;
142 152
  protected $_new;
143 153

  
154
  /**
155
   *
156
   */
144 157
  protected function linesToArray($lines) {
145 158
    $lines = trim($lines);
146 159

  
......
156 169
    return $array;
157 170
  }
158 171

  
159

  
172
  /**
173
   *
174
   */
160 175
  protected function pipeListToArray($mapping_list_txt, $make_item0_lowercase = FALSE) {
161 176
    $result_array = array();
162 177
    $mappings = preg_split('/[\n\r]+/', $mapping_list_txt);
......
168 183
    }
169 184
    return $result_array;
170 185
  }
186

  
171 187
}

Formats disponibles : Unified diff