Security update for permissions_by_term
[yaffs-website] / web / modules / contrib / permissions_by_term / permissions_by_term.install
1 <?php
2
3 /**
4  * @file
5  * Install, update and uninstall functions for the permissions_by_term module.
6  */
7
8 /**
9  * Implements hook_schema().
10  */
11 function permissions_by_term_schema() {
12
13   $schema = [];
14
15   // Specifications for tabe 'permissions_by_term_user'.
16   $schema['permissions_by_term_user'] = [
17     'description' => "Stores the tid's to which a user has permission by his uid.",
18     'fields' => [
19       'tid' => [
20         'type' => 'int',
21         'unsigned' => TRUE,
22         'not null' => TRUE,
23       ],
24       'uid' => [
25         'type' => 'int',
26         'unsigned' => TRUE,
27         'not null' => TRUE,
28       ],
29     ],
30     'primary key' => [
31       'tid',
32       'uid',
33     ],
34   ];
35
36   // Specifications for tabe 'permissions_by_term_role'.
37   $schema['permissions_by_term_role'] = [
38     'description' => "Stores the tid's to which user's are allowed to by rid.",
39     'fields' => [
40       'tid' => [
41         'type' => 'int',
42         'unsigned' => TRUE,
43         'not null' => TRUE,
44       ],
45       'rid' => [
46         'type' => 'varchar',
47         'length' => 60,
48         'not null' => TRUE,
49       ],
50     ],
51     'primary key' => [
52       'tid',
53       'rid',
54     ],
55   ];
56
57   return $schema;
58
59 }
60
61 /**
62  * Implements hook_install().
63  */
64 function permissions_by_term_install() {
65   node_access_rebuild(TRUE);
66 }
67
68 /**
69  * Implements hook_uninstall().
70  */
71 function permissions_by_term_uninstall() {
72   node_access_rebuild(TRUE);
73 }
74
75 /**
76  * Mandatory initial run of node_access_rebuild() Drupal core function.
77  */
78 function permissions_by_term_update_8113() {
79   node_access_rebuild(TRUE);
80 }
81
82 /**
83  * Force a node access rebuild to fix node access grants.
84  */
85 function permissions_by_term_update_8114() {
86   node_access_rebuild(TRUE);
87 }