Skip to content

Commit

Permalink
Dev: Removed Template Permissions Button and moved it to mass action
Browse files Browse the repository at this point in the history
  • Loading branch information
thedirtypanda committed Jul 14, 2021
1 parent 3c1149d commit 3680653
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion application/controllers/UserManagementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function actionIndex()

$aData['massiveAction'] = $this->renderPartial(
'massiveAction/_selector',
[],
['userid' => $model->uid],
true,
false
);
Expand Down
17 changes: 0 additions & 17 deletions application/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ public function getManagementButtons()
$editUrl = Yii::app()->getController()->createUrl('userManagement/addEditUser', ['userid' => $this->uid]);
$setPermissionsUrl = Yii::app()->getController()->createUrl('userManagement/userPermissions', ['userid' => $this->uid]);
$setRoleUrl = Yii::app()->getController()->createUrl('userManagement/addRole', ['userid' => $this->uid]);
$setTemplatePermissionsUrl = Yii::app()->getController()->createUrl('userManagement/userTemplatePermissions', ['userid' => $this->uid]);
$changeOwnershipUrl = Yii::app()->getController()->createUrl('userManagement/takeOwnership');
$deleteUrl = Yii::app()->getController()->createUrl('userManagement/deleteConfirm', ['userid' => $this->uid, 'user' => $this->full_name]);

Expand All @@ -601,13 +600,6 @@ class='btn btn-sm btn-default UserManagement--action--openmodal UserManagement--
class='btn btn-sm btn-default UserManagement--action--openmodal UserManagement--action--addrole'
style='margin-left: 5px;'
data-href='" . $setRoleUrl . "'><i class='fa fa-users'></i></button>";
$editTemplatePermissionButton = ""
. "<button
data-toggle='tooltip'
title='" . gT("Template permissions") . "'
class='btn btn-sm btn-default UserManagement--action--openmodal UserManagement--action--templatepermissions'
style='margin-left: 5px;'
data-href='" . $setTemplatePermissionsUrl . "'><i class='fa fa-paint-brush'></i></button>";
$editUserButton = ""
. "<button
data-toggle='tooltip'
Expand Down Expand Up @@ -658,7 +650,6 @@ class='btn btn-default btn-sm UserManagement--action--openmodal UserManagement--
$addRoleButton,
"\n",
$userDetail,
$editTemplatePermissionButton,
$this->parent_id != Yii::app()->session['loginID'] ? $takeOwnershipButton : '',
$deleteUserButton]);
}
Expand Down Expand Up @@ -696,14 +687,6 @@ class='btn btn-default btn-sm UserManagement--action--openmodal UserManagement--
) {
$buttonArray[] = $editPermissionButton;
}

//Check if user can set template permissions
if (
Permission::model()->hasGlobalPermission('templates', 'read') //Has global permission templates read
&& !Permission::isForcedSuperAdmin($this->uid) //Is not a forced superadmin
) {
$buttonArray[] = $editTemplatePermissionButton;
}

//Check if user can take ownership
if (
Expand Down
20 changes: 19 additions & 1 deletion application/views/userManagement/massiveAction/_selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,26 @@
//'htmlFooterButtons' => [],
'htmlModalBody' => App()->getController()->renderPartial('/userManagement/massiveAction/_updatepermissions', [], true)
),

// Template Permission
array(
'type' => 'action',
'action' => 'templatePermission',
'url' => Yii::app()->getController()->createUrl('userManagement/userTemplatePermissions', ['userid' => $userid]),
'iconClasses' => 'fa fa-paint-brush',
'text' => gT("Template permissions"),
'grid-reload' => 'yes',
'actionType' => 'modal',
'modalType' => 'cancel-apply',
'largeModalView' => true,
'keepopen' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => '',
'sModalTitle' => gT("Template permissions"),
'htmlModalBody' => App()->getController()->renderPartial('/userManagement/massiveAction/_updatepermissions', [], true),
),

)
),
);

if(Permission::model()->hasGlobalPermission('users', 'update')) {
Expand Down

0 comments on commit 3680653

Please sign in to comment.