1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Installation hooks for the CAS Server module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_schema().
|
10
|
*/
|
11
|
function cas_server_schema() {
|
12
|
$schema = array();
|
13
|
|
14
|
$schema['cas_server_tickets'] = array(
|
15
|
'description' => 'Stores CAS server tickets.',
|
16
|
'fields' => array(
|
17
|
'service' => array(
|
18
|
'type' => 'varchar',
|
19
|
'length' => 255,
|
20
|
'not null' => TRUE,
|
21
|
'default' => '',
|
22
|
),
|
23
|
'ticket' => array(
|
24
|
'type' => 'varchar',
|
25
|
'length' => 255,
|
26
|
'not null' => TRUE,
|
27
|
'default' => '',
|
28
|
),
|
29
|
'uid' => array(
|
30
|
'type' => 'int',
|
31
|
'unsigned' => TRUE,
|
32
|
'not null' => TRUE,
|
33
|
),
|
34
|
'timestamp' => array(
|
35
|
'type' => 'int',
|
36
|
'not null' => TRUE,
|
37
|
),
|
38
|
'valid' => array(
|
39
|
'type' => 'int',
|
40
|
'not null' => TRUE,
|
41
|
'default' => 1,
|
42
|
),
|
43
|
),
|
44
|
'primary key' => array('ticket'),
|
45
|
);
|
46
|
|
47
|
return $schema;
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* Implements hook_uninstall().
|
52
|
*/
|
53
|
function cas_server_uninstall() {
|
54
|
variable_del('cas_server_service_whitelist');
|
55
|
variable_del('cas_server_whitelist_failure');
|
56
|
}
|
57
|
|
58
|
/**
|
59
|
* Creates CAS server tickets table.
|
60
|
*/
|
61
|
function cas_server_update_7000() {
|
62
|
$schema = array();
|
63
|
|
64
|
$schema['cas_server_tickets'] = array(
|
65
|
'description' => 'Stores CAS server tickets.',
|
66
|
'fields' => array(
|
67
|
'service' => array(
|
68
|
'type' => 'varchar',
|
69
|
'length' => 255,
|
70
|
'not null' => TRUE,
|
71
|
'default' => '',
|
72
|
),
|
73
|
'ticket' => array(
|
74
|
'type' => 'varchar',
|
75
|
'length' => 255,
|
76
|
'not null' => TRUE,
|
77
|
'default' => '',
|
78
|
),
|
79
|
'uid' => array(
|
80
|
'type' => 'int',
|
81
|
'unsigned' => TRUE,
|
82
|
'not null' => TRUE,
|
83
|
),
|
84
|
'timestamp' => array(
|
85
|
'type' => 'int',
|
86
|
'not null' => TRUE,
|
87
|
),
|
88
|
),
|
89
|
'primary key' => array('ticket'),
|
90
|
);
|
91
|
|
92
|
$ret = array();
|
93
|
if (!db_table_exists('cas_server_tickets')) {
|
94
|
db_create_table('cas_server_tickets', $schema['cas_server_tickets']);
|
95
|
}
|
96
|
return $ret;
|
97
|
}
|
98
|
|
99
|
/**
|
100
|
* Adds valid field to indicate when ticket is valid for reuse.
|
101
|
*/
|
102
|
function cas_server_update_7101() {
|
103
|
if (!db_field_exists('cas_server_tickets', 'valid')) {
|
104
|
db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, ));
|
105
|
}
|
106
|
}
|