-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathopenid_connect.install
115 lines (105 loc) · 2.87 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 the OpenID Connect module.
*/
/**
* Implements hook_schema().
*/
function openid_connect_schema() {
$schema['openid_connect_authmap'] = array(
'description' => 'Stores OpenID Connect 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.",
),
'client_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The client name.',
),
'sub' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Unique subject identifier.',
),
),
'primary key' => array('aid'),
'indexes' => array(
'uid' => array('uid'),
'identifier' => array('client_name', 'sub'),
),
'foreign keys' => array(
'user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
);
return $schema;
}
/**
* Add default config for Facebook and LinkedIn provider.
*/
function openid_connect_update_8101() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('openid_connect.settings.facebook');
$config->set('enabled', false);
$config->set('settings', [
'client_id' => '',
'client_secret' => '',
'api_version' => '',
]);
$config->save(TRUE);
$config = $config_factory->getEditable('openid_connect.settings.linkedin');
$config->set('enabled', false);
$config->set('settings', [
'client_id' => '',
'client_secret' => '',
]);
$config->save(TRUE);
}
/**
* Add default config for GitHub provider.
*/
function openid_connect_update_8102() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('openid_connect.settings.github');
$config->set('enabled', false);
$config->set('settings', [
'client_id' => '',
'client_secret' => '',
]);
$config->save(TRUE);
}
/**
* Update the active config with the registration override value.
*/
function openid_connect_update_8103() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('openid_connect.settings');
$config->set('override_registration_settings', FALSE);
$config->save(TRUE);
}
/**
* Update the active config with the connect existing users value.
*/
function openid_connect_update_8104() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('openid_connect.settings');
$config->set('connect_existing_users', FALSE);
$config->save(TRUE);
}