-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebauth_addons.install
More file actions
68 lines (61 loc) · 2.3 KB
/
webauth_addons.install
File metadata and controls
68 lines (61 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* @file webauth_addons.install
* Install hooks provided by the Webauth Add-Ons module.
*/
/**
* Implements hook_install()
*/
function webauth_addons_install() {
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_set('webauth_user_register', variable_get('user_register'));
// Save the old setting for user register
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_set('user_register', '9505');
// Set the new user register setting to Stanford Only
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_set('intranet_base', 'intranet');
// Create variable for intranet base ($base_url/intranet)
foreach(user_roles() as $key => $role):
if(preg_match('/(sunet)/i', $role)):
$role_id = $key;
else:
continue;
endif;
endforeach;
$role_id = (isset($role_id) ? $role_id : '1');
\Drupal::configFactory()->getEditable('webauth_addons.settings')->set('webauth_addons_role', $role_id)->save(); // Default variable for what the SUNet Role is defined as.
}
/**
* Implements hook_uninstall()
*/
function webauth_addons_uninstall() {
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_set('user_register', variable_get('webauth_user_register'));
// Revert the user register setting to the before time
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_del('webauth_user_register');
// Delete temp variable
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// variable_del('intranet_base');
// Delete intranet base url variable
\Drupal::config('webauth_addons.settings')->clear('webauth_addons_role')->save(); // Delete webauth role
}