-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenid_connect.install
115 lines (105 loc) · 4.23 KB
/
openid_connect.install
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* @file
* Install, update, and uninstall functions for OpenID Connect module.
*/
/**
* Implements hook_schema().
*/
function openid_connect_schema() {
$schema['authmap'] = array(
'description' => 'Stores distributed authentication mapping.',
'fields' => array(
'aid' => array(
'description' => 'Primary Key: Unique authmap ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "User's {users}.uid.",
),
'authname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Unique authentication name.',
),
'module' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Module which is controlling the authentication.',
),
),
'unique keys' => array(
'authname' => array('authname', 'module'),
),
'primary key' => array('aid'),
'indexes' => array(
'uid_module' => array('uid', 'module'),
),
'foreign keys' => array(
'user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function openid_connect_uninstall() {
config('openid_connect.settings')->delete();
}
// TODO The old hook_update_N functions cannot be applied to Backdrop.
function openid_connect_update_7100() { }
/**
* Implements hook_update_last_removed().
*/
function openid_connect_update_last_removed() {
return 7100;
}
/**
* Migrate openid_connect variables to config.
*/
function openid_connect_update_1000() {
// Migrate any existing variables to config
$config = config('openid_connect.settings');
$config->set('openid_connect_clients_enabled', update_variable_get('openid_connect_clients_enabled', array()));
$config->set('openid_connect_always_save_userinfo', update_variable_get('openid_connect_always_save_userinfo', TRUE));
$config->set('openid_connect_user_pictures', update_variable_get('openid_connect_user_pictures', TRUE));
$config->set('openid_connect_connect_existing_users', update_variable_get('openid_connect_connect_existing_users', array()));
$config->set('openid_connect_userinfo_mapping_property_property_name', update_variable_get('openid_connect_userinfo_mapping_property_property_name', 'dynamic variable in file /openid_connect/openid_connect.module line 233'));
$config->set('openid_connect_client_clientname_client_id', update_variable_get('openid_connect_client_clientname_client_id', 'dynamic variable in file /openid_connect/openid_connect.install line 21'));
$config->set('openid_connect_client_clientname_client_secret', update_variable_get('openid_connect_client_clientname_client_secret', 'dynamic variable in file /openid_connect/openid_connect.install line 22'));
$config->set('openid_connect_client_client_name', update_variable_get('openid_connect_client_client_name', 'dynamic variable in file /openid_connect/openid_connect.module line 101'));
$config->set('openid_connect_userinfo_mapping_claims', update_variable_get('openid_connect_userinfo_mapping_claims', array()));
$config->save();
update_variable_del('openid_connect_clients_enabled');
update_variable_del('openid_connect_always_save_userinfo');
update_variable_del('openid_connect_user_pictures');
update_variable_del('openid_connect_connect_existing_users');
update_variable_del('openid_connect_userinfo_mapping_property_property_name');
update_variable_del('openid_connect_client_clientname_client_id');
update_variable_del('openid_connect_client_clientname_client_secret');
update_variable_del('openid_connect_client_client_name');
update_variable_del('openid_connect_userinfo_mapping_claims');
}
/**
* Implements hook_install().
*/
function openid_connect_install() {
// Dynamically generated variable data was detected.
// /openid_connect/openid_connect.module line 233
// /openid_connect/openid_connect.install line 21
// /openid_connect/openid_connect.install line 22
// /openid_connect/openid_connect.module line 101
}