/
editpermissions.php
87 lines (78 loc) · 4.57 KB
/
editpermissions.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
79
80
81
82
83
84
85
86
87
<?php
Yii::app()->getController()->renderPartial(
'/layouts/partial_modals/modal_header',
['modalTitle' => gT("Edit permissions")]
);
?>
<?=TbHtml::formTb(null, App()->createUrl('userManagement/saveUserPermissions'), 'post', ["id"=>"UserManagement--modalform"])?>
<div class="modal-body selector--edit-permissions-container table-responsive">
<div class="container-center">
<div class="row ls-space margin top-5 bottom-5 hidden" id="UserManagement--errors">
</div>
<input type='hidden' name='userid' value='<?php echo (isset($oUser) ? $oUser->uid : '');?>' />
<table id='UserManagement--userpermissions-table' class='activecell table table-striped'>
<thead>
<tr>
<th></th>
<th><?php eT("Permission");?></th>
<th><?php eT("General");?></th>
<th><?php eT("Create");?></th>
<th><?php eT("View/read");?></th>
<th><?php eT("Update");?></th>
<th><?php eT("Delete");?></th>
<th><?php eT("Import");?></th>
<th><?php eT("Export");?></th>
</tr>
</thead>
<!-- Permissions -->
<?php foreach($aBasePermissions as $sPermissionKey=>$aCRUDPermissions): ?>
<tr>
<!-- Icon -->
<td>
<i class="<?php echo $aCRUDPermissions['img']; ?> text-success"></i>
<?php echo $aCRUDPermissions['description'];?>
</td>
<!-- Warning super admin -->
<td>
<?php if ($sPermissionKey=='superadmin') {?> <span class='warning'> <?php }; echo $aCRUDPermissions['title']; if ($sPermissionKey=='superadmin') {?> </span> <?php };?>
</td>
<!-- checkbox -->
<td>
<input type="checkbox" class="general-row-selector" id='all_<?php echo $sPermissionKey;?>' name='PermissionAll[<?php echo $sPermissionKey;?>]' />
</td>
<!-- CRUD -->
<?php foreach ($aCRUDPermissions as $sCRUDKey=>$CRUDValue): ?>
<?php if (!in_array($sCRUDKey,array('create','read','update','delete','import','export'))) continue; ?>
<!-- Extended container -->
<td class='specific-settings-block'>
<?php if ($CRUDValue): ?>
<?php if (!($sPermissionKey=='survey' && $sCRUDKey=='read')): ?>
<!-- checkbox -->
<input type="checkbox" class="specific-permission-selector" name='Permission[<?php echo $sPermissionKey.']['.$sCRUDKey;?>]' id='perm_<?php echo $sPermissionKey.'_'.$sCRUDKey;?>'
<?php if(Permission::model()->hasGlobalPermission( $sPermissionKey, $sCRUDKey, $oUser->uid)):?>
checked="checked"
<?php endif; ?>
<?php if(substr($sPermissionKey,0,5) === 'auth_' && $sCRUDKey === 'read'): ?>
style="visibility:hidden"
<?php endif; ?>/>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
<div class="row ls-space margin top-25">
<?php if (safecount(Permission::model()->getUserRole($oUser->uid)) > 0 ): ?>
<div class="col-xs-12 alert alert-warning">
<?= gT("Warning: The user has at least one role assigned. Setting individual user permissions will remove all roles from this user!") ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="modal-footer modal-footer-buttons">
<button class="btn btn-cancel selector--exitForm" id="permission-modal-exitForm"><?=gT('Cancel')?></button>
<button class="btn btn-success selector--submitForm" id="permission-modal-submitForm"><?=gT('Save')?></button>
</div>
</form>