document_permissions.smarty
6.31 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<h2>{i18n}Document permissions{/i18n}</h2>
<p class="descriptiveText">{i18n}This page shows the permissions that apply to
this specific document. Where the folder view shows you information by role and group,
this page shows the actual groups (and, if they are assigned directly to a role, the users)
who have the different permissions. As a result, groups, users and roles with <strong>no</strong>
permissions are not shown.{/i18n}</p>
{if ((empty($roles) && empty($groups) && empty($users)))}
<div class="ktInfo"><p>{i18n}No roles or groups have been defined or have permissions.{/i18n}</p></div>
{else}
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="update">
<input type="hidden" name="fFolderId" value="{$iFolderId}">
<table class="kt_collection"cellspacing="0" cellpadding="0" border="0">
<thead>
<tr>
<th width="40%">Role or Group</th>
{ foreach item=oPerm from=$permissions }
<th title="{$oPerm->sName}" class="centered">{$oPerm->sHumanName}</th>
{ /foreach }
</tr>
</thead>
<tbody>
{ foreach item=oRole from=$roles }
<td><span class="descriptiveText">{i18n}Role:{/i18n}</span> {$oRole->getName()}</td>
{ assign var=iRoleId value=$oRole->getId() }
{ foreach item=oPerm from=$permissions }
{ assign var=iPermId value=$oPerm->getId() }
{ assign var=bHasPerm value=$aMapPermissionRole[$iPermId][$iRoleId] }
{ if $edit}
{ if $bHasPerm }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][role][]"
value="{$iRoleId}" checked="true"></td>
{ else }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][role][]"
value="{$iRoleId}"></td>
{ /if }
{else}
{ 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 }
{/if}
{ /foreach }
</tr>
{ /foreach }
{ foreach item=oGroup from=$groups }
<td><span class="descriptiveText">{i18n}Group:{/i18n}</span> {$oGroup->getName()}</td>
{ assign var=iGroupId value=$oGroup->getId() }
{ foreach item=oPerm from=$permissions }
{ assign var=iPermId value=$oPerm->getId() }
{ assign var=bHasPerm value=$aMapPermissionGroup[$iPermId][$iGroupId] }
{ if $edit}
{ if $bHasPerm }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}" checked="true"></td>
{ else }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}"></td>
{ /if }
{else}
{ 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 }
{/if}
{ /foreach }
</tr>
{ /foreach }
{ foreach item=oUser from=$users }
<td><span class="descriptiveText">{i18n}User: {/i18n}</span> {$oUser->getName()}</td>
{ assign var=iUserId value=$oUser->getId() }
{ foreach item=oPerm from=$permissions }
{ assign var=iPermId value=$oPerm->getId() }
{ assign var=bHasPerm value=$aMapPermissionUser[$iPermId][$iUserId] }
{ if $edit}
{ if $bHasPerm }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}" checked="true"></td>
{ else }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}"></td>
{ /if }
{else}
{ 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 }
{/if}
{ /foreach }
</tr>
{ /foreach }
</tbody>
</table>
{if $edit}
<div class="form_actions">
<input type="submit" value="{i18n}Update Permission Assignments{/i18n}" />
</div>
</form>
{/if}
{ /if }
{if (!empty($conditions))}
{if ($edit || $dynamic_conditions)}
<h2>{i18n}Dynamic permissions{/i18n}</h2>
{/if}
{ if $dynamic_conditions }
<table class="kt_collection" cellpadding="0" cellspacing="0">
<thead>
<tr>
{ if $edit }
<th width="1%">Remove</th>
{ /if }
<th>{i18n}Group{/i18n}</th>
<th>{i18n}Condition{/i18n}</th>
{foreach from=$permissions item=oPerm}
<th title="{$oPerm->sName}" class="centered">{$oPerm->sHumanName}</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=$permissions item=oPerm}
<th title="{$oPerm->sName}" class="centered">{$oPerm->sHumanName}</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=$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}