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
|
/**
|
52
|
* Creates CAS server tickets table.
|
53
|
*/
|
54
|
function cas_server_update_7000() {
|
55
|
$schema = array();
|
56
|
|
57
|
$schema['cas_server_tickets'] = array(
|
58
|
'description' => 'Stores CAS server tickets.',
|
59
|
'fields' => array(
|
60
|
'service' => array(
|
61
|
'type' => 'varchar',
|
62
|
'length' => 255,
|
63
|
'not null' => TRUE,
|
64
|
'default' => '',
|
65
|
),
|
66
|
'ticket' => array(
|
67
|
'type' => 'varchar',
|
68
|
'length' => 255,
|
69
|
'not null' => TRUE,
|
70
|
'default' => '',
|
71
|
),
|
72
|
'uid' => array(
|
73
|
'type' => 'int',
|
74
|
'unsigned' => TRUE,
|
75
|
'not null' => TRUE,
|
76
|
),
|
77
|
'timestamp' => array(
|
78
|
'type' => 'int',
|
79
|
'not null' => TRUE,
|
80
|
),
|
81
|
),
|
82
|
'primary key' => array('ticket'),
|
83
|
);
|
84
|
|
85
|
$ret = array();
|
86
|
if (!db_table_exists('cas_server_tickets')) {
|
87
|
db_create_table('cas_server_tickets', $schema['cas_server_tickets']);
|
88
|
}
|
89
|
return $ret;
|
90
|
}
|
91
|
|
92
|
/**
|
93
|
* Adds valid field to indicate when ticket is valid for reuse.
|
94
|
*/
|
95
|
function cas_server_update_7101() {
|
96
|
if (!db_field_exists('cas_server_tickets', 'valid')) {
|
97
|
db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, ));
|
98
|
}
|
99
|
}
|