eileenmcnaughton / nz.co.fuzion.relatedpermissions

Empowers inherited permissions throughout Civi
Other
9 stars 13 forks source link

E Notice Squashing #31

Open stesi561 opened 4 years ago

stesi561 commented 4 years ago

I'm seeing Notice: Undefined index: is_permission_a_b in relatedpermissions_civicrm_pre() (line 335 of extensiondir/nz.co.fuzion.relatedpermissions/relatedpermissions.php).

Version 1.8 -> https://github.com/eileenmcnaughton/nz.co.fuzion.relatedpermissions/blob/71b39a5f5d5bd283d0595168d8437d56afd7ad8e/relatedpermissions.php#L341

I'm wondering if this test should be empty($entityArray['is_permission_' . $direction] == '') instead of $entityArray['is_permission_' . $direction] == ''

Currently I've done an isset then check if it's the empty string to replicate current behaviour and prevent the E Notice.

I'm unclear however if this should be setting a default if the entityArray['is_permission_a_b'] or entityArray['is_permission_b_a'] is not set?

stesi561 commented 4 years ago

If not obvious what outcome should be I can have a deeper look to figure this out.

aydun commented 4 years ago

Hmm - so I wrote that a couple of years ago... Note that your notice is for line 335, not 341 as linked above.
I think 335 $permissionSettings['permission_' . $direction] != '' should be isset($permissionSettings['permission_' . $direction])

The intended behaviour was that in 'Enforce' mode, the permissions are enforced but in 'Default' mode the permissions are suggested but the user can change it. As I recall, there was some difficulty figuring out if a suggested value had been removed.