permissions.smarty
6.06 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<h2>Folder permissions for "{$foldername|sanitize}"</h2>
{* check if there are roles etc *}
{if ((empty($roles) && empty($groups)))}
<div class="ktInfoMessage"><span>{i18n}No roles or groups have been defined. Permissions can only be allocated to roles and groups.{/i18n}</span></div>
{else}
{* otherwise continue *}
<p>{i18n}Manage security{/i18n}: <a href="{addQS context=$context}{/addQS}">{i18n}View permissions overview{/i18n}</a>
| <a href="{addQS context=$context}action=resolved_users{/addQS}">{i18n}View resolved permissions for user{/i18n}</a>
</p>
{if ($can_inherit)}
<div class="ktInfoMessage">
<span>{i18n}This folder defines its own permissions.{/i18n}
<a class="ktActionLink ktDelete"
kt:deleteMessage="{i18n}Are you sure you wish to reinstate inherited permissions?{/i18n}"
href="{addQS context=$context}action=inheritPermissions{/addQS}">{i18n}Inherit permissions{/i18n}</a></span>
</div>
{/if}
{$context->oPage->requireJSResource("resources/js/jsonlookup.js")}
{$context->oPage->requireJSResource("resources/js/permissions.js")}
{capture assign=sJavascript}initializePermissions('entities', '{addQS}fFolderId={$context->oFolder->getId()}&action=json&json_action=getEntities{/addQS}', {$jsonpermissions});{/capture}
{$context->oPage->requireJSStandalone($sJavascript)}
<form action="{$smarty.server.PHP_SELF}" method="POST">
<div class="field">
<p class="descriptiveText">{i18n}Select roles and groups for whom you wish to change permission assignment from the box on the left, and move them over to the box on the right using the button with right-pointing arrows. You can then allocate or remove permissions from these entities and save by pressing the 'Update Permission Assignments' button'.{/i18n}</p>
<table>
<thead>
<tr>
<td style="width:45%"><label for="select_{$name}_avail">{i18n}Available Entities{/i18n}</label></td>
<td style="width:10%"> </td>
<td style="width:45%"><label for="select_{$name}_assigned">{i18n}Assigned Entities{/i18n}</label></td>
</tr>
</thead>
<tbody>
<tr>
<td style="vertical-align: top">
<select name="entities" id="select_entities_avail" multiple="true"size="5">
</select>
<div><label for="filter_entities_avail">{i18n}Filter{/i18n}</label><input type="text" id="filter_entities_avail" /><br/><a href="#" id="entities_show_all">{i18n}Show All{/i18n}</a></div>
</td>
<td>
<input type="button" id="entities_add" value="»" />
<br /><br/>
<input type="button" id="entities_remove" value="«" />
</td>
<td style="vertical-align: top">
<select name="entities" id="select_entities_assigned" multiple="true"size="5">
</select>
<div><label for="filter_entities_assigned">{i18n}Filter{/i18n}</label><input type="text" id="filter_entities_assigned" /></div>
</td>
</tr>
</tbody>
</table>
<input name="entities_items_added" id="entities_items_added" type="hidden" />
<input name="entities_items_removed" id="entities_items_removed" type="hidden" />
<input type="hidden" name="kt_core_fieldsets_expect[entities]" value ="1" />
</div>
<div id="permissions_table_container"></div>
<input type="hidden" name="action" value="update">
<input type="hidden" name="fFolderId" value="{$iFolderId}">
<div id="submitButtons" class="form_actions">
<input type="submit" value="{i18n}Update Permission Assignments{/i18n}" />
<input type="submit" name="kt_cancel[{addQS}fFolderId={$iFolderId}{/addQS}]" value="{i18n}Cancel{/i18n}" />
{/if}
</div>
</form>
{if (!empty($conditions))}
{if ($edit || $dynamic_conditions)}
<h2>{i18n}Dynamic permissions{/i18n}</h2>
{/if}
{ if $dynamic_conditions }
<table class="kt_collection narrow" cellpadding="0" cellspacing="0">
<thead>
<tr>
{ if $edit }
<th width="1%">{i18n}Remove{/i18n}</th>
{ /if }
<th>{i18n}Group{/i18n}</th>
<th>{i18n}Condition{/i18n}</th>
{foreach from=$permissions item=oPerm}
<th title="{$oPerm->getName()}" class="centered">{$oPerm->getHumanName()}</th>
{/foreach}
</tr>
</thead>
<tbody>
{ foreach from=$dynamic_conditions item=oDynamicCondition }
<tr>
{php}
$this->assign("oGroup", Group::get($this->_tpl_vars['oDynamicCondition']->getGroupId()));
$this->assign("oCondition", KTSavedSearch::get($this->_tpl_vars['oDynamicCondition']->getConditionId()));
$this->assign("aPermissions", $this->_tpl_vars['oDynamicCondition']->getAssignment());
{/php}
{ if $edit }
<td>
{capture assign=sQS}action=removeDynamicCondition&fFolderId={$iFolderId}&fDynamicConditionId={$oDynamicCondition->getId()}{/capture}
<a href="{$smarty.server.PHP_SELF|addQueryString:"$sQS"}" class="ktAction ktDelete">{i18n}Delete{/i18n}</a>
</td>
{/if}
<td>{$oGroup->getName()}</td>
<td>{$oCondition->getName()}</td>
{foreach from=$permissions item=oPerm}
{assign var=bHasPerm value=$oPerm->getId()|in_array:$aPermissions}
{ if $bHasPerm }
<td class="centered"><span class="ktAction ktInline ktAllowed">{i18n}Allowed{/i18n}</span></td>
{ else }
<td class="centered"><span class="ktAction ktInline ktDenied">{i18n}Denied{/i18n}</span></td>
{ /if }
{/foreach}
</tr>
{ /foreach }
</tbody>
</table>
{ /if }
{ if $edit }
<h3>{i18n}Add a new dynamic permission{/i18n}</h3>
<form action="{$smarty.server.PHP_SELF}" method="POST">
<table class="kt_collection" cellpadding="0" cellspacing="0">
<input type="hidden" name="action" value="newDynamicPermission" />
<input type="hidden" name="fFolderId" value="{$iFolderId}" />
<thead>
<tr>
<th>{i18n}Group{/i18n}</th>
<th>{i18n}Condition{/i18n}</th>
{foreach from=$document_permissions item=oPerm}
<th title="{$oPerm->getName()}" class="centered">{$oPerm->getHumanName()}</th>
{/foreach}
</tr>
</thead>
<tbody>
<tr>
<td>{entity_select entities=$groups name=fGroupId none=true}</td>
<td>{entity_select entities=$conditions name=fConditionId none=true}</td>
{entity_checkboxes entities=$document_permissions name=fPermissionIds assign=aPermissionCheckboxes method="none"}
{foreach from=$aPermissionCheckboxes item=sCheckbox}
<td class="centered">{$sCheckbox}</td>
{/foreach}
</tr>
</tbody>
</table>
<input type="submit" name="submit" value="{i18n}Add{/i18n}" />
</form>
{ /if }
{/if}