tbar0970 / jethro-pmm

Jethro Pastoral Ministry Manager
GNU General Public License v3.0
36 stars 26 forks source link

Congregations visible for attendance when attendance disabled #544

Closed GatesheadBen closed 5 years ago

GatesheadBen commented 6 years ago

1) A non-admin user is restricted to congregations 2) Congregations are disabled for attendance 3) The non-admin user still sees congregations listed in the attendance drop down menu

(Note: We have half a dozen congregations because we want to have rotas for mid-week events)

tbar0970 commented 6 years ago

Is the problem that congregations with attendance disabled are appearing in the list or that congregations the current user shouldn't see are appearing in the list?

GatesheadBen commented 6 years ago

Congregations with attendance disabled are appearing in the list.

On Tue, 13 Nov 2018 at 21:49, Tom Barrett notifications@github.com wrote:

Is the problem that congregations with attendance disabled are appearing in the list or that congregations the current user shouldn't see are appearing in the list?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tbar0970/jethro-pmm/issues/544#issuecomment-438450976, or mute the thread https://github.com/notifications/unsubscribe-auth/AL7vIve83BDjtFUFKFf9JRh0-3GBpNTFks5uuz5qgaJpZM4XY9me .

-- 07858 739412 11 Jubilee Ave - NE9 7HN

GatesheadBen commented 6 years ago

Hi Tom, I've started looking into this now.

Steps to reproduce:

  1. Disable attendance recording for a congregation by unchecking all attendance recording days
  2. Confirm that this congregation has now dissapeared from the drop down for recording attendance
  3. Apply restrictions which GRANT a restricted user access to that congregation
  4. See that the congregation is now appearing in the drop down for recording attendance even though recording is not possible

It looks to me like congregation.class.php lines 75 to 79 are removing the '!attendance_recording_days' => 0 from the logic part of the query.

i.e. my un-restricted user gets WHERE (NOT (congregation.attendance_recording_days = '0')) and my restricted user gets WHERE congregation.id IN ('2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','7','7','7','7','7','7','7','7','7','7','7','7','7','7','7','8','8','8','8','8','8','8','8','8','8','8','8','8','8','8','11','11','11','11','11','11','11','11','11','11','11','11','11','11','11','14','14','14','14','14','14','14','14','14','14','14','14','14','14','14','15','15','15','15','15','15','15','15','15','15','15','15','15','15','15') AND (congregation.id IN ('2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','7','7','7','7','7','7','7','7','7','7','7','7','7','7','7','8','8','8','8','8','8','8','8','8','8','8','8','8','8','8','11','11','11','11','11','11','11','11','11','11','11','11','11','11','11','14','14','14','14','14','14','14','14','14','14','14','14','14','14','14','15','15','15','15','15','15','15','15','15','15','15','15','15','15','15') )

I suspect line 79 should change from if ($oldwhere) $res['where'] .= ' AND ('.$res['where'].')'; to if ($oldwhere) $res['where'] .= ' AND ('.$oldwhere.')';

???

Thanks,

Ben

tbar0970 commented 5 years ago

Thanks, that sounds right, I've committed that fix.