| 1 |
<?php
|
| 2 |
// $Id: openid_provider.install,v 1.1 2008/04/13 11:53:04 walkah Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_requirements().
|
| 6 |
*/
|
| 7 |
function openid_provider_requirements($phase) {
|
| 8 |
$requirements = array();
|
| 9 |
// Ensure translations don't break at install time
|
| 10 |
$t = get_t();
|
| 11 |
|
| 12 |
if ($phase == 'runtime') {
|
| 13 |
if (user_access('access user profiles', drupal_anonymous_user())) {
|
| 14 |
$requirements['openid_provider'] = array(
|
| 15 |
'value' => $t('Enabled')
|
| 16 |
);
|
| 17 |
}
|
| 18 |
else {
|
| 19 |
$requirements['openid_provider'] = array(
|
| 20 |
'value' => $t('Disabled'),
|
| 21 |
'severity' => REQUIREMENT_ERROR,
|
| 22 |
'description' => $t('Openid Provider requires that anonymous users have <a href="@url">access user profile permission</a> to work properly.', array('@url' => url('admin/user/permissions/'. DRUPAL_ANONYMOUS_RID))),
|
| 23 |
);
|
| 24 |
}
|
| 25 |
$requirements['openid_provider']['title'] = $t('Anon user profile access');
|
| 26 |
}
|
| 27 |
return $requirements;
|
| 28 |
}
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Implementation of hook_install().
|
| 32 |
*/
|
| 33 |
function openid_provider_install() {
|
| 34 |
// Create tables.
|
| 35 |
drupal_install_schema('openid_provider');
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* Implementation of hook_uninstall().
|
| 40 |
*/
|
| 41 |
function openid_provider_uninstall() {
|
| 42 |
// Remove tables.
|
| 43 |
drupal_uninstall_schema('openid_provider');
|
| 44 |
}
|
| 45 |
|
| 46 |
/**
|
| 47 |
* Implementation of hook_schema().
|
| 48 |
*/
|
| 49 |
function openid_provider_schema() {
|
| 50 |
$schema['openid_provider_relying_party'] = array(
|
| 51 |
'description' => t('Tracks relying parties a give user has authenticated.'),
|
| 52 |
'fields' => array(
|
| 53 |
'rpid' => array(
|
| 54 |
'type' => 'serial',
|
| 55 |
'unsigned' => TRUE,
|
| 56 |
'not null' => TRUE
|
| 57 |
),
|
| 58 |
'uid' => array(
|
| 59 |
'type' => 'int',
|
| 60 |
'unsigned' => TRUE,
|
| 61 |
'not null' => TRUE,
|
| 62 |
'description' => t('The {users}.uid that has authenticated this relying party.'),
|
| 63 |
),
|
| 64 |
'realm' => array(
|
| 65 |
'type' => 'varchar',
|
| 66 |
'length' => 255,
|
| 67 |
'not null' => TRUE,
|
| 68 |
'default' => '',
|
| 69 |
'description' => t('The OpenID realm of the authenticated relying party.'),
|
| 70 |
),
|
| 71 |
'first_time' => array(
|
| 72 |
'type' => 'int',
|
| 73 |
'not null' => TRUE,
|
| 74 |
'default' => 0,
|
| 75 |
'description' => t('Timestamp of the first time this relying party was accessed.')
|
| 76 |
),
|
| 77 |
'last_time' => array(
|
| 78 |
'type' => 'int',
|
| 79 |
'not null' => TRUE,
|
| 80 |
'default' => 0,
|
| 81 |
'description' => t('Timestamp of the most recent access'),
|
| 82 |
),
|
| 83 |
'auto_release' => array(
|
| 84 |
'type' => 'int',
|
| 85 |
'not null' => TRUE,
|
| 86 |
'default' => 0,
|
| 87 |
'description' => t('Whether or not to automatically release this relying party.')
|
| 88 |
),
|
| 89 |
),
|
| 90 |
'indexes' => array('uid' => array('uid')),
|
| 91 |
'primary key' => array('rpid')
|
| 92 |
);
|
| 93 |
|
| 94 |
$schema['openid_provider_association'] = array(
|
| 95 |
'description' => t('Stores current associaitons with relying parties.'),
|
| 96 |
'fields' => array(
|
| 97 |
'assoc_handle' => array(
|
| 98 |
'type' => 'varchar',
|
| 99 |
'length' => 255,
|
| 100 |
'not null' => TRUE,
|
| 101 |
'default' => ''
|
| 102 |
),
|
| 103 |
'assoc_type' => array(
|
| 104 |
'type' => 'varchar',
|
| 105 |
'length' => 32,
|
| 106 |
'not null' => TRUE,
|
| 107 |
'default' => ''
|
| 108 |
),
|
| 109 |
'session_type' => array(
|
| 110 |
'type' => 'varchar',
|
| 111 |
'length' => 32,
|
| 112 |
'not null' => TRUE,
|
| 113 |
'default' => ''
|
| 114 |
),
|
| 115 |
'mac_key' => array(
|
| 116 |
'type' => 'varchar',
|
| 117 |
'length' => 255,
|
| 118 |
'not null' => TRUE,
|
| 119 |
'default' => ''
|
| 120 |
),
|
| 121 |
'created' => array(
|
| 122 |
'type' => 'int',
|
| 123 |
'not null' => TRUE,
|
| 124 |
'default' => 0,
|
| 125 |
),
|
| 126 |
'expires_in' => array(
|
| 127 |
'type' => 'int',
|
| 128 |
'not null' => TRUE,
|
| 129 |
'default' => 0,
|
| 130 |
)
|
| 131 |
),
|
| 132 |
'primary key' => array('assoc_handle')
|
| 133 |
);
|
| 134 |
|
| 135 |
return $schema;
|
| 136 |
}
|