1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
$tables = [
'liberty_content_role_map' => "
content_id I4 PRIMARY,
role_id I4 PRIMARY
CONSTRAINT ', CONSTRAINT `protector_role_ref` FOREIGN KEY (`role_id`) REFERENCES `".BIT_DB_PREFIX."users_roles` (`role_id`)
, CONSTRAINT `protector_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)'
",
];
global $gBitInstaller;
foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( PROTECTOR_PKG_NAME, $tableName, $tables[$tableName] );
}
$gBitInstaller->registerPackageInfo( PROTECTOR_PKG_NAME, [
'description' => "Protector restricts access to content based on user roles.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
] );
// ### Indexes
//$indices = array (
//);
//$gBitInstaller->registerSchemaIndexes( PROTECTOR_PKG_NAME, $indices );
// ### Sequences
//$sequences = [
// 'protector_security_id_seq' => [ 'start' => 1 ]
//];
//$gBitInstaller->registerSchemaSequences( PROTECTOR_PKG_NAME, $sequences );
// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( PROTECTOR_PKG_NAME, [
[ 'bit_p_create_protector', 'Can create a protector', 'registered', PROTECTOR_PKG_NAME ],
[ 'bit_p_protector_edit', 'Can edit any protector', 'editors', PROTECTOR_PKG_NAME ],
[ 'bit_p_protector_admin', 'Can admin protector', 'editors', PROTECTOR_PKG_NAME ],
[ 'bit_p_read_protector', 'Can read protector', 'basic', PROTECTOR_PKG_NAME ],
] );
// ### Default Preferences
$gBitInstaller->registerPreferences( PROTECTOR_PKG_NAME, [
[ PROTECTOR_PKG_NAME, 'protector_default_ordering','title_desc' ],
[ PROTECTOR_PKG_NAME, 'protector_list_content_id','y' ],
[ PROTECTOR_PKG_NAME, 'protector_list_title','y' ],
[ PROTECTOR_PKG_NAME, 'protector_list_description','y' ],
[ PROTECTOR_PKG_NAME, 'protector_single_role','y' ],
] );
|