-
Notifications
You must be signed in to change notification settings - Fork 51
/
transport.policies.php
78 lines (72 loc) · 2.4 KB
/
transport.policies.php
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
$policies = array();
$tmp = array(
'TicketUserPolicy' => array(
'description' => 'A policy for create and update Tickets.',
'data' => array(
'ticket_delete' => true,
'ticket_publish' => true,
'ticket_save' => true,
'ticket_vote' => true,
'ticket_star' => true,
'section_unsubscribe' => true,
'comment_save' => true,
'comment_delete' => true,
'comment_remove' => true,
'comment_publish' => true,
'comment_file_upload' => true,
'comment_vote' => true,
'comment_star' => true,
'ticket_file_upload' => true,
'ticket_file_delete' => true,
'thread_close' => true,
'thread_delete' => true,
'thread_remove' => true,
),
),
'TicketSectionPolicy' => array(
'description' => 'A policy for add tickets in section.',
'data' => array(
'section_add_children' => true,
),
),
'TicketVipPolicy' => array(
'description' => 'A policy for create and update private Tickets.',
'data' => array(
'ticket_delete' => true,
'ticket_publish' => true,
'ticket_save' => true,
'ticket_vote' => true,
'ticket_star' => true,
'section_unsubscribe' => true,
'comment_save' => true,
'comment_delete' => true,
'comment_remove' => true,
'comment_publish' => true,
'comment_file_upload' => true,
'comment_vote' => true,
'comment_star' => true,
'ticket_view_private' => true,
'ticket_file_upload' => true,
'ticket_file_delete' => true,
'thread_close' => true,
'thread_delete' => true,
'thread_remove' => true,
),
),
);
/** @var modx $modx */
foreach ($tmp as $k => $v) {
if (isset($v['data'])) {
$v['data'] = json_encode($v['data']);
}
/** @var $policy modAccessPolicy */
$policy = $modx->newObject('modAccessPolicy');
$policy->fromArray(array_merge(array(
'name' => $k,
'lexicon' => PKG_NAME_LOWER . ':permissions',
), $v)
, '', true, true);
$policies[] = $policy;
}
return $policies;