[Vtigercrm-developers] Error to delete lists Vtiger 7.3 (06/2021)

Rubén A. Estrada Orozco rulotec1 at gmail.com
Thu Jun 10 16:18:22 GMT 2021


Alan, I also had a hard time trying to figure it out. Part of the job of a
good developer is to create expressive code (not just code that works,
which is half the job at most, but code that can be easily understood and
maintained).

With that goal in mind and using De Morgan as you propose, I would suggest:

$viewBelongsToCurrentUser = ($customViewOwner == $currentUser->getId());

if (!($currentUser->isAdminUser() || $viewBelongsToCurrentUser)) {
    throw new AppException("PERMISSION_DENIED");
}

I think the above is more "brain-friendly".

Saludos

Rubén


On Wed, Jun 9, 2021 at 4:44 AM Sukhdev Mohan <s.mohan at myti.it> wrote:

> Also to be remembered or statements are shortcutted sonic the first
> statement is true it'll execute the block. While in an AND it's shortcutted
> if the first statement is false.
>
>
> Il mer 9 giu 2021, 09:38 Alan Lord <alanslists at gmail.com> ha scritto:
>
>> Comparing two not tests often throws me too and it turns out it's even a
>> "thing".
>>
>> https://en.wikipedia.org/wiki/De_Morgan%27s_laws
>>
>> >     not (A or B) = not A and not B
>> >     not (A and B) = not A or not B.
>>
>> :-D
>>
>> On 09/06/2021 08:25, Alan Lord wrote:
>> > Henry, good catch! It would be good to create a new ticket explaining
>> > this bug and to create a Merge Request with the fix. If you are not
>> > able, let this list know and I am sure one of us can do it on your
>> behalf.
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20210610/d444a452/attachment.html>


More information about the vtigercrm-developers mailing list