Révision 32700c57
Ajouté par Assos Assos il y a environ 5 ans
drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
function ldap_user_requirements($phase) { |
12 | 12 |
|
13 |
$requirements = array();
|
|
13 |
$requirements = [];
|
|
14 | 14 |
|
15 | 15 |
if ($phase == 'runtime') { |
16 | 16 |
|
17 |
// check for all $user->* fields created
|
|
17 |
// Check for all $user->* fields created.
|
|
18 | 18 |
$missing_fields = ldap_user_update_check_user_fields(TRUE); |
19 | 19 |
if (count($missing_fields)) { |
20 | 20 |
$requirements['ldap_user']['title'] = t('User Fields for LDAP User Module Missing'); |
... | ... | |
24 | 24 |
$requirements['ldap_user']['description'] = t('Fields are added to the |
25 | 25 |
Drupal User entity for LDAP User module functionality. These fields should |
26 | 26 |
have been created in LDAP User update 7203. The following userfields are missing:') . |
27 |
theme('item_list', array(
|
|
27 |
theme('item_list', [
|
|
28 | 28 |
'items' => $missing_fields, |
29 | 29 |
'type' => 'ul', |
30 | 30 |
'title' => NULL, |
31 |
)) .
|
|
31 |
]) .
|
|
32 | 32 |
t('Rerun update 7203 to correct this; it will not write over destroy existing fields.'); |
33 | 33 |
} |
34 | 34 |
} |
35 | 35 |
|
36 |
|
|
37 |
// check that ldapauth not installed. |
|
36 |
// Check that ldapauth not installed. |
|
38 | 37 |
return $requirements; |
39 | 38 |
|
40 | 39 |
} |
... | ... | |
52 | 51 |
} |
53 | 52 |
} |
54 | 53 |
|
55 |
// make ldap user weight slightly less than other ldap modules so it can load
|
|
54 |
// Make ldap user weight slightly less than other ldap modules so it can load
|
|
56 | 55 |
// user's associated ldap data first and save on ldap queries. |
57 |
|
|
58 | 56 |
db_query("UPDATE {system} SET weight = -1 WHERE name = 'ldap_user'"); |
59 | 57 |
|
60 | 58 |
_ldap_user_install_update_authmap(); |
61 | 59 |
|
62 |
|
|
63 |
|
|
64 | 60 |
} |
65 | 61 |
|
62 |
/** |
|
63 |
* |
|
64 |
*/ |
|
66 | 65 |
function _ldap_user_install_update_authmap() { |
67 | 66 |
db_update('authmap') |
68 |
->fields( |
|
69 |
array(
|
|
67 |
->fields(
|
|
68 |
[
|
|
70 | 69 |
'module' => 'ldap_user', |
71 |
)
|
|
70 |
]
|
|
72 | 71 |
) |
73 |
->condition('module', 'ldap_authentication') |
|
74 |
->execute(); |
|
72 |
->condition('module', 'ldap_authentication')
|
|
73 |
->execute();
|
|
75 | 74 |
|
76 | 75 |
} |
77 | 76 |
|
... | ... | |
104 | 103 |
*/ |
105 | 104 |
function ldap_user_schema() { |
106 | 105 |
|
107 |
|
|
108 | 106 |
} |
109 | 107 |
|
110 |
|
|
111 |
// see http://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7 |
|
112 |
|
|
113 |
|
|
108 |
/** |
|
109 |
* See http://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7. |
|
110 |
*/ |
|
114 | 111 |
function ldap_user_user_entity_fields() { |
115 | 112 |
|
116 |
$fields = array();
|
|
113 |
$fields = [];
|
|
117 | 114 |
|
118 | 115 |
$field_name = 'ldap_user_puid_sid'; |
119 |
$fields[$field_name]['field'] = array(
|
|
116 |
$fields[$field_name]['field'] = [
|
|
120 | 117 |
'field_name' => $field_name, |
121 | 118 |
'type' => 'text', |
122 |
'entity_types' => array('user'),
|
|
119 |
'entity_types' => ['user'],
|
|
123 | 120 |
'cardinality' => 1, |
124 | 121 |
'translatable' => 0, |
125 | 122 |
'locked' => 1, |
126 | 123 |
'module' => 'text', |
127 | 124 |
'no_ui' => 1, |
128 |
'settings' => array(), |
|
129 |
); |
|
130 |
|
|
131 |
$fields[$field_name]['instance'] = array( |
|
132 |
'field_name' => $field_name, |
|
133 |
'entity_type' => 'user', |
|
134 |
'bundle' => 'user', |
|
135 |
'label' => 'LDAP Server ID that puid was derived from. NULL if puid is independent of server configuration instance.', |
|
136 |
'description' => 'This field should not be edited.', |
|
137 |
'required' => 0, |
|
138 |
'default_value' => array(), |
|
139 |
'settings' => array( |
|
140 |
'text_processing' => 0, |
|
141 |
), |
|
142 |
'widget' => array( |
|
143 |
'type' => 'ldap_user_hidden', |
|
144 |
'settings' => array(), |
|
145 |
'module' => 'ldap_user', |
|
146 |
), |
|
147 |
'display' => array( |
|
148 |
'default' => array( |
|
149 |
'label' => 'hidden', |
|
150 |
'type' => 'hidden', |
|
151 |
), |
|
152 |
'full' => array( |
|
153 |
'label' => 'hidden', |
|
154 |
'type' => 'hidden', |
|
155 |
), |
|
156 |
'teaser' => array( |
|
157 |
'label' => 'hidden', |
|
158 |
'type' => 'hidden', |
|
159 |
), |
|
160 |
)); |
|
125 |
'settings' => [], |
|
126 |
]; |
|
161 | 127 |
|
128 |
$fields[$field_name]['instance'] = [ |
|
129 |
'field_name' => $field_name, |
|
130 |
'entity_type' => 'user', |
|
131 |
'bundle' => 'user', |
|
132 |
'label' => 'LDAP Server ID that puid was derived from. NULL if puid is independent of server configuration instance.', |
|
133 |
'description' => 'This field should not be edited.', |
|
134 |
'required' => 0, |
|
135 |
'default_value' => [], |
|
136 |
'settings' => [ |
|
137 |
'text_processing' => 0, |
|
138 |
], |
|
139 |
'widget' => [ |
|
140 |
'type' => 'ldap_user_hidden', |
|
141 |
'settings' => [], |
|
142 |
'module' => 'ldap_user', |
|
143 |
], |
|
144 |
'display' => [ |
|
145 |
'default' => [ |
|
146 |
'label' => 'hidden', |
|
147 |
'type' => 'hidden', |
|
148 |
], |
|
149 |
'full' => [ |
|
150 |
'label' => 'hidden', |
|
151 |
'type' => 'hidden', |
|
152 |
], |
|
153 |
'teaser' => [ |
|
154 |
'label' => 'hidden', |
|
155 |
'type' => 'hidden', |
|
156 |
], |
|
157 |
], |
|
158 |
]; |
|
162 | 159 |
|
163 | 160 |
$field_name = 'ldap_user_puid'; |
164 |
$fields[$field_name]['field'] = array( |
|
165 |
'field_name' => $field_name, |
|
166 |
'type' => 'text', |
|
167 |
'entity_types' => array('user'), |
|
168 |
'cardinality' => 1, |
|
169 |
'translatable' => 0, |
|
170 |
'locked' => 1, |
|
171 |
'module' => 'text', |
|
172 |
'no_ui' => 1, |
|
173 |
'settings' => array(), |
|
174 |
); |
|
175 |
|
|
176 |
$fields[$field_name]['instance'] = array( |
|
177 |
'field_name' => $field_name, |
|
178 |
'entity_type' => 'user', |
|
179 |
'bundle' => 'user', |
|
180 |
'label' => 'Value of user\'s permanent unique id. This should never change for a given ldap identified user.', |
|
181 |
'description' => 'This field should not be edited.', |
|
182 |
'required' => 0, |
|
183 |
'default_value' => array(), |
|
184 |
'settings' => array( |
|
185 |
'text_processing' => 0, |
|
186 |
), |
|
187 |
'widget' => array( |
|
188 |
'type' => 'ldap_user_hidden', |
|
189 |
'settings' => array(), |
|
190 |
'module' => 'ldap_user', |
|
191 |
), |
|
192 |
'display' => array( |
|
193 |
'default' => array( |
|
194 |
'label' => 'hidden', |
|
195 |
'type' => 'hidden', |
|
196 |
), |
|
197 |
'full' => array( |
|
198 |
'label' => 'hidden', |
|
199 |
'type' => 'hidden', |
|
200 |
), |
|
201 |
'teaser' => array( |
|
202 |
'label' => 'hidden', |
|
203 |
'type' => 'hidden', |
|
204 |
), |
|
205 |
)); |
|
161 |
$fields[$field_name]['field'] = [ |
|
162 |
'field_name' => $field_name, |
|
163 |
'type' => 'text', |
|
164 |
'entity_types' => ['user'], |
|
165 |
'cardinality' => 1, |
|
166 |
'translatable' => 0, |
|
167 |
'locked' => 1, |
|
168 |
'module' => 'text', |
|
169 |
'no_ui' => 1, |
|
170 |
'settings' => [], |
|
171 |
]; |
|
172 |
|
|
173 |
$fields[$field_name]['instance'] = [ |
|
174 |
'field_name' => $field_name, |
|
175 |
'entity_type' => 'user', |
|
176 |
'bundle' => 'user', |
|
177 |
'label' => 'Value of user\'s permanent unique id. This should never change for a given ldap identified user.', |
|
178 |
'description' => 'This field should not be edited.', |
|
179 |
'required' => 0, |
|
180 |
'default_value' => [], |
|
181 |
'settings' => [ |
|
182 |
'text_processing' => 0, |
|
183 |
], |
|
184 |
'widget' => [ |
|
185 |
'type' => 'ldap_user_hidden', |
|
186 |
'settings' => [], |
|
187 |
'module' => 'ldap_user', |
|
188 |
], |
|
189 |
'display' => [ |
|
190 |
'default' => [ |
|
191 |
'label' => 'hidden', |
|
192 |
'type' => 'hidden', |
|
193 |
], |
|
194 |
'full' => [ |
|
195 |
'label' => 'hidden', |
|
196 |
'type' => 'hidden', |
|
197 |
], |
|
198 |
'teaser' => [ |
|
199 |
'label' => 'hidden', |
|
200 |
'type' => 'hidden', |
|
201 |
], |
|
202 |
], |
|
203 |
]; |
|
206 | 204 |
|
207 | 205 |
$field_name = 'ldap_user_puid_property'; |
208 |
$fields[$field_name]['field'] = array( |
|
209 |
'field_name' => $field_name, |
|
210 |
'type' => 'text', |
|
211 |
'entity_types' => array('user'), |
|
212 |
'cardinality' => 1, |
|
213 |
'translatable' => 0, |
|
214 |
'locked' => 1, |
|
215 |
'module' => 'text', |
|
216 |
'no_ui' => 1, |
|
217 |
'settings' => array(), |
|
218 |
); |
|
219 |
|
|
220 |
$fields[$field_name]['instance'] = array( |
|
221 |
'field_name' => $field_name, |
|
222 |
'entity_type' => 'user', |
|
223 |
'bundle' => 'user', |
|
224 |
'label' => 'Property specified as user\'s puid.', |
|
225 |
'description' => 'This field should not be edited.', |
|
226 |
'required' => 0, |
|
227 |
'default_value' => array(), |
|
228 |
'settings' => array( |
|
229 |
'text_processing' => 0, |
|
230 |
), |
|
231 |
'widget' => array( |
|
232 |
'type' => 'ldap_user_hidden', |
|
233 |
'settings' => array(), |
|
234 |
'module' => 'ldap_user', |
|
235 |
), |
|
236 |
'display' => array( |
|
237 |
'default' => array( |
|
238 |
'label' => 'hidden', |
|
239 |
'type' => 'hidden', |
|
240 |
), |
|
241 |
'full' => array( |
|
242 |
'label' => 'hidden', |
|
243 |
'type' => 'hidden', |
|
244 |
), |
|
245 |
'teaser' => array( |
|
246 |
'label' => 'hidden', |
|
247 |
'type' => 'hidden', |
|
248 |
), |
|
249 |
)); |
|
206 |
$fields[$field_name]['field'] = [ |
|
207 |
'field_name' => $field_name, |
|
208 |
'type' => 'text', |
|
209 |
'entity_types' => ['user'], |
|
210 |
'cardinality' => 1, |
|
211 |
'translatable' => 0, |
|
212 |
'locked' => 1, |
|
213 |
'module' => 'text', |
|
214 |
'no_ui' => 1, |
|
215 |
'settings' => [], |
|
216 |
]; |
|
217 |
|
|
218 |
$fields[$field_name]['instance'] = [ |
|
219 |
'field_name' => $field_name, |
|
220 |
'entity_type' => 'user', |
|
221 |
'bundle' => 'user', |
|
222 |
'label' => 'Property specified as user\'s puid.', |
|
223 |
'description' => 'This field should not be edited.', |
|
224 |
'required' => 0, |
|
225 |
'default_value' => [], |
|
226 |
'settings' => [ |
|
227 |
'text_processing' => 0, |
|
228 |
], |
|
229 |
'widget' => [ |
|
230 |
'type' => 'ldap_user_hidden', |
|
231 |
'settings' => [], |
|
232 |
'module' => 'ldap_user', |
|
233 |
], |
|
234 |
'display' => [ |
|
235 |
'default' => [ |
|
236 |
'label' => 'hidden', |
|
237 |
'type' => 'hidden', |
|
238 |
], |
|
239 |
'full' => [ |
|
240 |
'label' => 'hidden', |
|
241 |
'type' => 'hidden', |
|
242 |
], |
|
243 |
'teaser' => [ |
|
244 |
'label' => 'hidden', |
|
245 |
'type' => 'hidden', |
|
246 |
], |
|
247 |
], |
|
248 |
]; |
|
250 | 249 |
|
251 | 250 |
$field_name = 'ldap_user_current_dn'; |
252 |
$fields[$field_name]['field'] = array( |
|
253 |
'field_name' => $field_name, |
|
254 |
'type' => 'text', |
|
255 |
'entity_types' => array('user'), |
|
256 |
'cardinality' => 1, |
|
257 |
'translatable' => 0, |
|
258 |
'locked' => 1, |
|
259 |
'module' => 'text', |
|
260 |
'no_ui' => 1, |
|
261 |
'settings' => array(), |
|
262 |
); |
|
263 |
|
|
264 |
$fields[$field_name]['instance'] = array( |
|
265 |
'field_name' => $field_name, |
|
266 |
'entity_type' => 'user', |
|
267 |
'bundle' => 'user', |
|
268 |
'label' => 'User LDAP DN', |
|
269 |
'description' => 'May change when user\'s DN changes. This field should not be edited.', |
|
270 |
'required' => 0, |
|
271 |
'default_value' => array(), |
|
272 |
'settings' => array( |
|
273 |
'text_processing' => 0, |
|
274 |
), |
|
275 |
'widget' => array( |
|
276 |
'type' => 'ldap_user_hidden', |
|
277 |
'settings' => array(), |
|
278 |
'module' => 'ldap_user', |
|
279 |
), |
|
280 |
'display' => array( |
|
281 |
'default' => array( |
|
282 |
'label' => 'hidden', |
|
283 |
'type' => 'hidden', |
|
284 |
), |
|
285 |
'full' => array( |
|
286 |
'label' => 'hidden', |
|
287 |
'type' => 'hidden', |
|
288 |
), |
|
289 |
'teaser' => array( |
|
290 |
'label' => 'hidden', |
|
291 |
'type' => 'hidden', |
|
292 |
), |
|
293 |
)); |
|
251 |
$fields[$field_name]['field'] = [ |
|
252 |
'field_name' => $field_name, |
|
253 |
'type' => 'text', |
|
254 |
'entity_types' => ['user'], |
|
255 |
'cardinality' => 1, |
|
256 |
'translatable' => 0, |
|
257 |
'locked' => 1, |
|
258 |
'module' => 'text', |
|
259 |
'no_ui' => 1, |
|
260 |
'settings' => [], |
|
261 |
]; |
|
262 |
|
|
263 |
$fields[$field_name]['instance'] = [ |
|
264 |
'field_name' => $field_name, |
|
265 |
'entity_type' => 'user', |
|
266 |
'bundle' => 'user', |
|
267 |
'label' => 'User LDAP DN', |
|
268 |
'description' => 'May change when user\'s DN changes. This field should not be edited.', |
|
269 |
'required' => 0, |
|
270 |
'default_value' => [], |
|
271 |
'settings' => [ |
|
272 |
'text_processing' => 0, |
|
273 |
], |
|
274 |
'widget' => [ |
|
275 |
'type' => 'ldap_user_hidden', |
|
276 |
'settings' => [], |
|
277 |
'module' => 'ldap_user', |
|
278 |
], |
|
279 |
'display' => [ |
|
280 |
'default' => [ |
|
281 |
'label' => 'hidden', |
|
282 |
'type' => 'hidden', |
|
283 |
], |
|
284 |
'full' => [ |
|
285 |
'label' => 'hidden', |
|
286 |
'type' => 'hidden', |
|
287 |
], |
|
288 |
'teaser' => [ |
|
289 |
'label' => 'hidden', |
|
290 |
'type' => 'hidden', |
|
291 |
], |
|
292 |
], |
|
293 |
]; |
|
294 | 294 |
|
295 | 295 |
$field_name = 'ldap_user_prov_entries'; |
296 |
$fields[$field_name]['field'] = array(
|
|
296 |
$fields[$field_name]['field'] = [
|
|
297 | 297 |
'field_name' => $field_name, |
298 | 298 |
'type' => 'text', |
299 |
'entity_types' => array('user'),
|
|
299 |
'entity_types' => ['user'],
|
|
300 | 300 |
'cardinality' => FIELD_CARDINALITY_UNLIMITED, |
301 | 301 |
'translatable' => 0, |
302 | 302 |
'locked' => 1, |
303 | 303 |
'module' => 'text', |
304 | 304 |
'no_ui' => 1, |
305 |
'settings' => array(), |
|
306 |
); |
|
307 |
|
|
308 |
$fields[$field_name]['instance'] = array( |
|
309 |
'field_name' => $field_name, |
|
310 |
'entity_type' => 'user', |
|
311 |
'bundle' => 'user', |
|
312 |
'label' => 'LDAP Entries that have been provisioned from this Drupal user.', |
|
313 |
'description' => 'This field should not be edited.', |
|
314 |
'required' => 0, |
|
315 |
'default_value' => NULL, |
|
316 |
'settings' => array( |
|
317 |
'text_processing' => 0, |
|
318 |
), |
|
319 |
'widget' => array( |
|
320 |
'type' => 'ldap_user_hidden', |
|
321 |
'settings' => array(), |
|
322 |
'module' => 'ldap_user', |
|
323 |
), |
|
324 |
'display' => array( |
|
325 |
'default' => array( |
|
326 |
'label' => 'hidden', |
|
327 |
'type' => 'hidden', |
|
328 |
), |
|
329 |
'full' => array( |
|
330 |
'label' => 'hidden', |
|
331 |
'type' => 'hidden', |
|
332 |
), |
|
333 |
'teaser' => array( |
|
334 |
'label' => 'hidden', |
|
335 |
'type' => 'hidden', |
|
336 |
), |
|
337 |
)); |
|
305 |
'settings' => [], |
|
306 |
]; |
|
307 |
|
|
308 |
$fields[$field_name]['instance'] = [ |
|
309 |
'field_name' => $field_name, |
|
310 |
'entity_type' => 'user', |
|
311 |
'bundle' => 'user', |
|
312 |
'label' => 'LDAP Entries that have been provisioned from this Drupal user.', |
|
313 |
'description' => 'This field should not be edited.', |
|
314 |
'required' => 0, |
|
315 |
'default_value' => NULL, |
|
316 |
'settings' => [ |
|
317 |
'text_processing' => 0, |
|
318 |
], |
|
319 |
'widget' => [ |
|
320 |
'type' => 'ldap_user_hidden', |
|
321 |
'settings' => [], |
|
322 |
'module' => 'ldap_user', |
|
323 |
], |
|
324 |
'display' => [ |
|
325 |
'default' => [ |
|
326 |
'label' => 'hidden', |
|
327 |
'type' => 'hidden', |
|
328 |
], |
|
329 |
'full' => [ |
|
330 |
'label' => 'hidden', |
|
331 |
'type' => 'hidden', |
|
332 |
], |
|
333 |
'teaser' => [ |
|
334 |
'label' => 'hidden', |
|
335 |
'type' => 'hidden', |
|
336 |
], |
|
337 |
], |
|
338 |
]; |
|
338 | 339 |
|
339 | 340 |
$field_name = 'ldap_user_last_checked'; |
340 |
$fields[$field_name]['field'] = array(
|
|
341 |
$fields[$field_name]['field'] = [
|
|
341 | 342 |
'field_name' => $field_name, |
342 | 343 |
'type' => 'number_integer', |
343 |
'entity_types' => array('user'),
|
|
344 |
'entity_types' => ['user'],
|
|
344 | 345 |
'cardinality' => 1, |
345 | 346 |
'translatable' => 0, |
346 | 347 |
'locked' => 1, |
347 | 348 |
'module' => 'number', |
348 | 349 |
'no_ui' => 1, |
349 |
'settings' => array(),
|
|
350 |
);
|
|
351 |
|
|
352 |
$fields[$field_name]['instance'] = array(
|
|
353 |
'field_name' => $field_name,
|
|
354 |
'entity_type' => 'user',
|
|
355 |
'bundle' => 'user',
|
|
356 |
'label' => 'Unix timestamp of when Drupal user was compard to ldap entry. This could be for purposes of synching, deleteing drupal account, etc.',
|
|
357 |
'description' => 'This field should not be edited.',
|
|
358 |
'required' => 0,
|
|
359 |
'default_value' => NULL,
|
|
360 |
'settings' => array(
|
|
361 |
),
|
|
362 |
'widget' => array(
|
|
363 |
'type' => 'ldap_user_hidden',
|
|
364 |
'settings' => array(),
|
|
365 |
'module' => 'ldap_user',
|
|
366 |
),
|
|
367 |
'display' => array(
|
|
368 |
'default' => array(
|
|
369 |
'label' => 'hidden',
|
|
370 |
'type' => 'hidden',
|
|
371 |
),
|
|
372 |
'full' => array(
|
|
373 |
'label' => 'hidden',
|
|
374 |
'type' => 'hidden',
|
|
375 |
),
|
|
376 |
'teaser' => array(
|
|
377 |
'label' => 'hidden',
|
|
378 |
'type' => 'hidden',
|
|
379 |
),
|
|
380 |
));
|
|
350 |
'settings' => [],
|
|
351 |
];
|
|
352 |
|
|
353 |
$fields[$field_name]['instance'] = [
|
|
354 |
'field_name' => $field_name, |
|
355 |
'entity_type' => 'user', |
|
356 |
'bundle' => 'user', |
|
357 |
'label' => 'Unix timestamp of when Drupal user was compard to ldap entry. This could be for purposes of synching, deleteing drupal account, etc.', |
|
358 |
'description' => 'This field should not be edited.', |
|
359 |
'required' => 0, |
|
360 |
'default_value' => NULL, |
|
361 |
'settings' => [],
|
|
362 |
'widget' => [
|
|
363 |
'type' => 'ldap_user_hidden',
|
|
364 |
'settings' => [],
|
|
365 |
'module' => 'ldap_user',
|
|
366 |
],
|
|
367 |
'display' => [
|
|
368 |
'default' => [
|
|
369 |
'label' => 'hidden',
|
|
370 |
'type' => 'hidden',
|
|
371 |
],
|
|
372 |
'full' => [
|
|
373 |
'label' => 'hidden',
|
|
374 |
'type' => 'hidden',
|
|
375 |
],
|
|
376 |
'teaser' => [
|
|
377 |
'label' => 'hidden',
|
|
378 |
'type' => 'hidden',
|
|
379 |
],
|
|
380 |
],
|
|
381 |
];
|
|
381 | 382 |
|
382 | 383 |
$field_name = 'ldap_user_ldap_exclude'; |
383 |
$fields[$field_name]['field'] = array(
|
|
384 |
$fields[$field_name]['field'] = [
|
|
384 | 385 |
'field_name' => $field_name, |
385 | 386 |
'type' => 'number_integer', |
386 |
'entity_types' => array('user'),
|
|
387 |
'entity_types' => ['user'],
|
|
387 | 388 |
'cardinality' => 1, |
388 | 389 |
'translatable' => 0, |
389 | 390 |
'locked' => 1, |
390 | 391 |
'module' => 'number', |
391 | 392 |
'no_ui' => 1, |
392 |
'settings' => array(),
|
|
393 |
);
|
|
394 |
|
|
395 |
$fields[$field_name]['instance'] = array(
|
|
396 |
'field_name' => $field_name,
|
|
397 |
'entity_type' => 'user',
|
|
398 |
'bundle' => 'user',
|
|
399 |
'label' => 'Whether to exclude the user from LDAP functionality',
|
|
400 |
'description' => 'This field should not be edited.',
|
|
401 |
'required' => 0,
|
|
402 |
'default_value' => 0,
|
|
403 |
'settings' => array(
|
|
404 |
),
|
|
405 |
'widget' => array(
|
|
406 |
'type' => 'ldap_user_hidden',
|
|
407 |
'settings' => array(),
|
|
408 |
'module' => 'ldap_user',
|
|
409 |
),
|
|
410 |
'display' => array(
|
|
411 |
'default' => array(
|
|
412 |
'label' => 'hidden',
|
|
413 |
'type' => 'hidden',
|
|
414 |
),
|
|
415 |
'full' => array(
|
|
416 |
'label' => 'hidden',
|
|
417 |
'type' => 'hidden',
|
|
418 |
),
|
|
419 |
'teaser' => array(
|
|
420 |
'label' => 'hidden',
|
|
421 |
'type' => 'hidden',
|
|
422 |
),
|
|
423 |
));
|
|
424 |
|
|
393 |
'settings' => [],
|
|
394 |
];
|
|
395 |
|
|
396 |
$fields[$field_name]['instance'] = [
|
|
397 |
'field_name' => $field_name, |
|
398 |
'entity_type' => 'user', |
|
399 |
'bundle' => 'user', |
|
400 |
'label' => 'Whether to exclude the user from LDAP functionality', |
|
401 |
'description' => 'This field should not be edited.', |
|
402 |
'required' => 0, |
|
403 |
'default_value' => 0, |
|
404 |
'settings' => [],
|
|
405 |
'widget' => [
|
|
406 |
'type' => 'ldap_user_hidden',
|
|
407 |
'settings' => [],
|
|
408 |
'module' => 'ldap_user',
|
|
409 |
],
|
|
410 |
'display' => [
|
|
411 |
'default' => [
|
|
412 |
'label' => 'hidden',
|
|
413 |
'type' => 'hidden',
|
|
414 |
],
|
|
415 |
'full' => [
|
|
416 |
'label' => 'hidden',
|
|
417 |
'type' => 'hidden',
|
|
418 |
],
|
|
419 |
'teaser' => [
|
|
420 |
'label' => 'hidden',
|
|
421 |
'type' => 'hidden',
|
|
422 |
],
|
|
423 |
],
|
|
424 |
];
|
|
425 |
|
|
425 | 426 |
return $fields; |
426 | 427 |
} |
427 | 428 |
|
428 |
|
|
429 | 429 |
/** |
430 |
* update authmap table, changing ldap_authentication to ldap_user, disable ldap_profile
|
|
430 |
* Update authmap table, changing ldap_authentication to ldap_user, disable ldap_profile.
|
|
431 | 431 |
*/ |
432 |
|
|
433 | 432 |
function ldap_user_update_7201() { |
434 | 433 |
if (module_exists('ldap_profile')) { |
435 |
module_disable(array('ldap_profile', TRUE));
|
|
434 |
module_disable(['ldap_profile', TRUE]);
|
|
436 | 435 |
} |
437 | 436 |
_ldap_user_install_update_authmap(); |
438 | 437 |
} |
439 | 438 |
|
440 |
|
|
441 | 439 |
/** |
442 |
* attach ldap_user_last_checked field to user entity to track reconciliation of ldap and drupal accounts
|
|
440 |
* Attach ldap_user_last_checked field to user entity to track reconciliation of ldap and drupal accounts.
|
|
443 | 441 |
*/ |
444 |
|
|
445 | 442 |
function ldap_user_update_7202() { |
446 | 443 |
|
447 | 444 |
return t('ldap_user_last_checked field added to user entity.'); |
448 | 445 |
|
449 | 446 |
} |
450 | 447 |
|
451 |
|
|
452 |
|
|
453 | 448 |
/** |
454 |
* make sure all user entity fields are created
|
|
449 |
* Make sure all user entity fields are created.
|
|
455 | 450 |
*/ |
456 | 451 |
function ldap_user_update_7203() { |
457 | 452 |
|
458 | 453 |
if (module_exists('ldap_groups')) { |
459 |
module_disable(array('ldap_groups', TRUE));
|
|
454 |
module_disable(['ldap_groups', TRUE]);
|
|
460 | 455 |
} |
461 | 456 |
|
462 | 457 |
$fields_added = ldap_user_update_check_user_fields(); |
463 | 458 |
|
464 | 459 |
if (count($fields_added)) { |
465 | 460 |
$fields = join(', ', $fields_added); |
466 |
return t('%fields added to user entity.', array('%fields' => $fields));
|
|
461 |
return t('%fields added to user entity.', ['%fields' => $fields]);
|
|
467 | 462 |
} |
468 | 463 |
else { |
469 | 464 |
return t('no fields needed to be added to user entity.'); |
... | ... | |
472 | 467 |
} |
473 | 468 |
|
474 | 469 |
/** |
475 |
* make sure all user entity field instances are created
|
|
470 |
* Make sure all user entity field instances are created.
|
|
476 | 471 |
*/ |
477 | 472 |
function ldap_user_update_7204() { |
478 | 473 |
|
... | ... | |
480 | 475 |
|
481 | 476 |
if (count($fields_added)) { |
482 | 477 |
$fields = join(', ', $fields_added); |
483 |
return t('%fields added to user entity.', array('%fields' => $fields));
|
|
478 |
return t('%fields added to user entity.', ['%fields' => $fields]);
|
|
484 | 479 |
} |
485 | 480 |
else { |
486 | 481 |
return t('no fields needed to be added to user entity.'); |
... | ... | |
489 | 484 |
} |
490 | 485 |
|
491 | 486 |
/** |
492 |
* make sure all user entity field instances are created
|
|
487 |
* Make sure all user entity field instances are created.
|
|
493 | 488 |
*/ |
494 | 489 |
function ldap_user_update_7205() { |
495 | 490 |
|
... | ... | |
497 | 492 |
|
498 | 493 |
} |
499 | 494 |
|
495 |
/** |
|
496 |
* |
|
497 |
*/ |
|
500 | 498 |
function ldap_user_update_check_user_fields($query = FALSE) { |
501 | 499 |
if (!$query) { |
502 |
module_enable(array('number'));
|
|
500 |
module_enable(['number']);
|
|
503 | 501 |
} |
504 |
$fields_added = array();
|
|
502 |
$fields_added = [];
|
|
505 | 503 |
foreach (ldap_user_user_entity_fields() as $field_id => $field_conf) { |
506 | 504 |
$field_info = field_info_field($field_id); |
507 | 505 |
if (!$field_info) { |
Formats disponibles : Unified diff
Weekly update of contrib modules