How do I HIDE the DELETE item in the LIST ACTIONS dropdown?

Tried adding a custom ACL to disallow DELETE as per

https://enricosimonetti.com/powerful-customisations-with-sugars-acl/

but this does NOT seem to work when I try it on Sugar 13.0.3

custom\Extension\modules\Contacts\Ext\Vardefs\acl.php

Fullscreen
1
$dictionary['Contacts']['acls']['SugarACLDenyDelete'] = true;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

custom\data\acl\SugarACLDenyDelete.php

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class SugarACLDenyDelete extends SugarACLStrategy {
// allowed user ids
protected $user_ids_to_allow = array(
);
// denied actions: example was READ-ONLY, we want to deny only DELETE
protected $denied_actions = array(
//'edit',
'delete',
//'massupdate',
//'import',
);
// our custom method to check permissions
protected function _canUserWrite($context)
{
// retrieve user from context
$user = $this->getCurrentUser($context);
// allow only admin users or special users access
if(/*$user->isAdmin() || */in_array($user->id, $this->user_ids_to_allow)) { //we DENY to ADMINS too
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Can anyone point me to a way that works in v13+?

Parents
  • Hello  , 

    I didn't review all code of the SugarACLDenyDelete.php but there is a small issue on your vardef. 
    Instead of 'Contacts' it should read 'Contact': 

    Fullscreen
    1
    $dictionary['Contact']['acls']['SugarACLDenyDelete'] = true;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Can you change, run a QRR and let us know if that was the piece that was missing? 

    Cheers, 

    André 

  • Thanks, with that change the DELETE item is still in the menu, but when I try to select a contact and then DELETE it, a 403 error occurs and the contact is not deleted.

    Is there a way to tale the DELETE item out of the dropdown list so users can't even try?

Reply
  • Thanks, with that change the DELETE item is still in the menu, but when I try to select a contact and then DELETE it, a 403 error occurs and the contact is not deleted.

    Is there a way to tale the DELETE item out of the dropdown list so users can't even try?

Children