| 1 |
<?php
|
| 2 |
// $Id: node_privacy_byrole.install,v 1.3.2.4 2009/02/13 16:49:05 deekayen Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install information for Node Privacy By Role.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* @file
|
| 11 |
* Install information for Node Privacy By Role.
|
| 12 |
*/
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Implementation of hook_schema().
|
| 16 |
*
|
| 17 |
* @return array
|
| 18 |
*/
|
| 19 |
function node_privacy_byrole_schema() {
|
| 20 |
return array(
|
| 21 |
'node_privacy_byrole' => array(
|
| 22 |
'fields' => array(
|
| 23 |
'nid' => array(
|
| 24 |
'type' => 'int',
|
| 25 |
'unsigned' => TRUE,
|
| 26 |
'not null' => TRUE,
|
| 27 |
'default' => 0,
|
| 28 |
'disp-width' => 10),
|
| 29 |
'gid' => array(
|
| 30 |
'type' => 'int',
|
| 31 |
'unsigned' => TRUE,
|
| 32 |
'not null' => TRUE,
|
| 33 |
'default' => 0,
|
| 34 |
'disp-width' => 10),
|
| 35 |
'realm' => array(
|
| 36 |
'type' => 'varchar',
|
| 37 |
'length' => '255',
|
| 38 |
'not null' => TRUE,
|
| 39 |
'default' => ''),
|
| 40 |
'grant_view' => array(
|
| 41 |
'type' => 'int',
|
| 42 |
'unsigned' => TRUE,
|
| 43 |
'size' => 'tiny',
|
| 44 |
'not null' => TRUE,
|
| 45 |
'default' => 0,
|
| 46 |
'disp-width' => '3'),
|
| 47 |
'grant_update' => array(
|
| 48 |
'type' => 'int',
|
| 49 |
'unsigned' => TRUE,
|
| 50 |
'size' => 'tiny',
|
| 51 |
'not null' => TRUE,
|
| 52 |
'default' => 0,
|
| 53 |
'disp-width' => '3'),
|
| 54 |
'grant_delete' => array(
|
| 55 |
'type' => 'int',
|
| 56 |
'unsigned' => TRUE,
|
| 57 |
'size' => 'tiny',
|
| 58 |
'not null' => TRUE,
|
| 59 |
'default' => 0,
|
| 60 |
'disp-width' => '3')
|
| 61 |
),
|
| 62 |
'primary key' => array('nid', 'gid', 'realm')
|
| 63 |
)
|
| 64 |
);
|
| 65 |
return $schema;
|
| 66 |
}
|
| 67 |
|
| 68 |
/**
|
| 69 |
* Implementation of hook_install().
|
| 70 |
*/
|
| 71 |
function node_privacy_byrole_install() {
|
| 72 |
drupal_install_schema('node_privacy_byrole');
|
| 73 |
}
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Implementation of hook_uninstall().
|
| 77 |
*/
|
| 78 |
function node_privacy_byrole_uninstall() {
|
| 79 |
drupal_uninstall_schema('node_privacy_byrole');
|
| 80 |
// Delete npbr variables holding defaults for content types.
|
| 81 |
db_query("DELETE FROM {variable} WHERE name LIKE 'npbr_default_%'");
|
| 82 |
variable_del('npbr_default_permissions');
|
| 83 |
drupal_set_message(t('TIP: If all your nodes say access denied, it may be necessary to !rebuild.', array('!rebuild' => l(t('rebuild permissions'), 'admin/content/node-settings'))));
|
| 84 |
}
|
| 85 |
|
| 86 |
/**
|
| 87 |
* Implementation of hook_enable()
|
| 88 |
*/
|
| 89 |
function node_privacy_byrole_enable() {
|
| 90 |
node_access_needs_rebuild();
|
| 91 |
}
|
| 92 |
|
| 93 |
/**
|
| 94 |
* Implementation of hook_disable()
|
| 95 |
*/
|
| 96 |
function node_privacy_byrole_disable() {
|
| 97 |
node_privacy_byrole_disabling(TRUE);
|
| 98 |
node_access_needs_rebuild();
|
| 99 |
}
|