Projet

Général

Profil

Révision 32700c57

Ajouté par Assos Assos il y a environ 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.module
31 31
 */
32 32
function ldap_authorization_menu() {
33 33

  
34
  $items['admin/config/people/ldap/authorization'] = array(
34
  $items['admin/config/people/ldap/authorization'] = [
35 35
    'title' => 'Authorization',
36 36
    'page callback' => 'ldap_authorizations_admin_index',
37
    'page arguments' => array(),
37
    'page arguments' => [],
38 38
    'type' => MENU_LOCAL_TASK,
39
    'access arguments' => array('administer site configuration'),
39
    'access arguments' => ['administer site configuration'],
40 40
    'file' => 'ldap_authorization.admin.inc',
41 41
    'weight' => 3,
42
  );
42
  ];
43 43

  
44
  $items['admin/config/people/ldap/authorization/list'] = array(
44
  $items['admin/config/people/ldap/authorization/list'] = [
45 45
    'title' => 'List',
46 46
    'type' => MENU_DEFAULT_LOCAL_TASK,
47
  );
47
  ];
48 48

  
49
  $items['admin/config/people/ldap/authorization/edit/%'] = array(
49
  $items['admin/config/people/ldap/authorization/edit/%'] = [
50 50
    'title' => 'Edit LDAP Authorization Configuration',
51 51
    'page callback' => 'drupal_get_form',
52
    'page arguments' => array('ldap_authorization_admin_form', 6, 'edit'),
53
    'access arguments' => array('administer site configuration'),
52
    'page arguments' => ['ldap_authorization_admin_form', 6, 'edit'],
53
    'access arguments' => ['administer site configuration'],
54 54
    'file' => 'ldap_authorization.admin.inc',
55
  );
55
  ];
56 56

  
57
  $items['admin/config/people/ldap/authorization/delete/%'] = array(
57
  $items['admin/config/people/ldap/authorization/delete/%'] = [
58 58
    'title' => 'Delete LDAP Authorization Configuration',
59 59
    'description' => 'Delete an ldap authorization configuration',
60 60
    'page callback' => 'drupal_get_form',
61
    'page arguments' => array('ldap_authorization_admin_form', 6, 'delete'),
62
    'access arguments' => array('administer site configuration'),
61
    'page arguments' => ['ldap_authorization_admin_form', 6, 'delete'],
62
    'access arguments' => ['administer site configuration'],
63 63
    'file' => 'ldap_authorization.admin.inc',
64
  );
64
  ];
65 65

  
66
  $items['admin/config/people/ldap/authorization/test/%'] = array(
66
  $items['admin/config/people/ldap/authorization/test/%'] = [
67 67
    'title' => 'Test LDAP Authorization Configuration',
68 68
    'description' => 'Test an ldap authorization configuration',
69 69
    'page callback' => 'drupal_get_form',
70
    'page arguments' => array('ldap_authorization_test_form', 6, 'test'),
71
    'access arguments' => array('administer site configuration'),
70
    'page arguments' => ['ldap_authorization_test_form', 6, 'test'],
71
    'access arguments' => ['administer site configuration'],
72 72
    'file' => 'ldap_authorization.admin.test.inc',
73
  );
73
  ];
74 74

  
75
  $items['admin/config/people/ldap/authorization/add/%'] = array(
75
  $items['admin/config/people/ldap/authorization/add/%'] = [
76 76
    'title' => 'Add Authorization Configuration',
77 77
    'page callback' => 'drupal_get_form',
78
    'page arguments' => array('ldap_authorization_admin_form', 6, 'add'),
79
    'access arguments' => array('administer site configuration'),
78
    'page arguments' => ['ldap_authorization_admin_form', 6, 'add'],
79
    'access arguments' => ['administer site configuration'],
80 80
    'file' => 'ldap_authorization.admin.inc',
81
  );
81
  ];
82 82

  
83 83
  return $items;
84 84
}
......
90 90
  list($authorizations, $notifications) = ldap_authorizations_user_authorizations($user, 'set', NULL, 'logon');
91 91
  if (variable_get('ldap_help_watchdog_detail', FALSE)) {
92 92
    foreach ($authorizations as $consumer_type => $authorization_ids) {
93
      $ul = theme('item_list', array('title' => $consumer_type, 'items' => array_keys($authorization_ids), 'type' => 'ul'));
94
      watchdog('ldap_authentication', 'ldap_authorization_user_login.authorizations' . $ul, array(), WATCHDOG_DEBUG);
93
      $ul = theme('item_list', ['title' => $consumer_type, 'items' => array_keys($authorization_ids), 'type' => 'ul']);
94
      watchdog('ldap_authentication', 'ldap_authorization_user_login.authorizations' . $ul, [], WATCHDOG_DEBUG);
95 95
    }
96 96
  }
97 97
}
......
114 114
 */
115 115
function ldap_authorization_ldap_server_in_use($sid, $server_name) {
116 116

  
117
  $use_warnings = array();
117
  $use_warnings = [];
118 118
  $consumers = ldap_authorization_get_consumers();
119 119
  foreach (ldap_authorization_get_consumers() as $consumer_type => $consumer_conf) {
120 120
    $consumer_conf['%server_name'] = $server_name;
......
141 141
      if ($consumer_conf->server->groupUserMembershipsAttrExists) {
142 142
        $attribute_name = $consumer_conf->server->groupUserMembershipsAttr;
143 143
        if ($attribute_name) {
144
          // array($attribute_name, 0, NULL);.
145 144
          $attribute_maps[$attribute_name] = ldap_servers_set_attribute_map($attribute_name);
146 145
        }
147 146
      }
......
182 181
 *
183 182
 */
184 183
function ldap_authorization_theme() {
185
  return array(
186
    'ldap_authorization_test_results' => array(
187
      'variables' => array('data' => NULL),
184
  return [
185
    'ldap_authorization_test_results' => [
186
      'variables' => ['data' => NULL],
188 187
      'render element' => 'element',
189 188
      'file' => 'ldap_authorization.theme.inc',
190
    ),
191
    'ldap_authorization_admin_index' => array(
192
      'variables' => array('consumers' => NULL),
189
    ],
190
    'ldap_authorization_admin_index' => [
191
      'variables' => ['consumers' => NULL],
193 192
      'render element' => 'element',
194 193
      'file' => 'ldap_authorization.theme.inc',
195
    ),
196
  );
194
    ],
195
  ];
197 196
}
198 197

  
199 198
/**
200 199
 * Param string $consumer_type is machine name of consumer such as drupal_role.
201 200
 *
202
 * @return consumer object
201
 * @return object
203 202
 */
204 203
function ldap_authorization_get_consumer_object($consumer_type) {
205 204

  
......
240 239
    return isset($consumers[$consumer_type]) ? $consumers[$consumer_type] : FALSE;
241 240
  }
242 241
  else {
243
    return isset($consumers[$consumer_type]) ? array($consumer_type => $consumers[$consumer_type]) : array();
242
    return isset($consumers[$consumer_type]) ? [$consumer_type => $consumers[$consumer_type]] : [];
244 243
  }
245 244

  
246 245
}
......
249 248
 * @rationale: need not be called from hook_user, so this function separated out
250 249
 * so it can be called from a batch synchronization process for example
251 250
 *
252
 * @param drupal user object $user
251
 * @param object $user
253 252
 * @param string $op
254 253
 *   indicating operation such as query, set, test_query, etc.
255 254
 * @param string $consumer_type
......
266 265
  }
267 266
  else {
268 267
    $consumers = ldap_authorization_get_consumers();
269
    $new_authorizations = array();
270
    $notifications = array();
268
    $new_authorizations = [];
269
    $notifications = [];
271 270
    foreach ($consumers as $consumer_type => $consumer) {
272 271
      list($new_authorizations_i, $notifications_i) = _ldap_authorizations_user_authorizations($user, $op, $consumer_type, $context);
273 272
      $new_authorizations = $new_authorizations + $new_authorizations_i;
......
275 274
    }
276 275

  
277 276
  }
278
  return array($new_authorizations, $notifications);
277
  return [$new_authorizations, $notifications];
279 278
}
280 279

  
281 280
/**
......
287 286
    user attributes, etc to determine user authorization (Drupal roles, organic group memberships,
288 287
    etc.)
289 288
    More detailed help is available on drupal.org at !helplink.',
290
          array(
289
          [
291 290
            '!helplink' => l(LDAP_SERVERS_DRUPAL_HELP_URL, LDAP_SERVERS_DRUPAL_HELP_URL),
292
          ));
291
          ]);
293 292

  
294 293
  switch ($path) {
295 294
    case 'admin/config/people/ldap/authorization':
......
305 304
/**
306 305
 * Just tokens for better watchdog and drupal_set_message arguments .**/
307 306
function ldap_authorization_tokens($consumer) {
308
  $tokens = array();
307
  $tokens = [];
309 308

  
310 309
  if (is_object($consumer)) {
311
    foreach (array('%', '!', '@') as $symbol) {
312
      foreach (array('name', 'namePlural', 'shortName', 'shortNamePlural', 'consumerModule', 'consumerType', 'mappingDirections', 'testLink', 'editLink') as $property) {
310
    foreach (['%', '!', '@'] as $symbol) {
311
      foreach (['name', 'namePlural', 'shortName', 'shortNamePlural', 'consumerModule', 'consumerType', 'mappingDirections', 'testLink', 'editLink'] as $property) {
313 312
        $tokens[$symbol . 'consumer_' . $property] = $consumer->$property;
314 313
      }
315 314
      if (is_object($consumer->consumerConf)) {
316
        foreach (array('sid', 'status') as $property) {
315
        foreach (['sid', 'status'] as $property) {
317 316
          $tokens[$symbol . 'consumer_' . $property] = $consumer->consumerConf->$property;
318 317
        }
319 318
      }
......
354 353
function ldap_authorization_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
355 354

  
356 355
  // This is a case where a field is being denied synching configuration because its not meant to be used by other modules.
357
  $available_user_attrs['[field.ldap_authorizations]'] = array(
356
  $available_user_attrs['[field.ldap_authorizations]'] = [
358 357
    'name' => 'Field: LDAP Authorizations',
359 358
    'source' => 'LDAP Authorization modules',
360 359
    'configurable_to_drupal' => 0,
......
363 362
    'direction' => NULL,
364 363
    'enabled' => FALSE,
365 364
    'config_module' => 'ldap_authorization',
366
    'prov_events' => array(),
365
    'prov_events' => [],
367 366
    'prov_module' => 'ldap_authorization',
368 367
    'exclude_from_mapping_ui' => TRUE,
369
  );
368
  ];
370 369

  
371 370
}

Formats disponibles : Unified diff