https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20956

Ayoub Glizi-Vicioso <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #191477|0                           |1
        is obsolete|                            |

--- Comment #67 from Ayoub Glizi-Vicioso <[email protected]> ---
Created attachment 192510
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192510&action=edit
Bug 20956: (QA follow-up) Match getuserflags() return structure

This patch changes Koha::Patron->permissions() to return the same
structure as C4::Auth::getuserflags() for architectural consistency.

Previously, permissions() only returned granted permissions:
{
  catalogue => 1,
  circulate => { override_renewals => 1 }
}

Now it returns ALL flags (matching getuserflags()):
{
  superlibrarian => 0,
  catalogue => 1,
  circulate => { override_renewals => 1 },
  borrowers => 0,
  ...
}

This provides several benefits:

1. Consistency - Matches established C4::Auth::getuserflags() pattern
2. Simpler checks - Can use "if ($flags->{module})" instead of
   "if (exists $flags->{module})"
3. Future compatibility - Enables eventual deprecation of getuserflags()
   in favor of the ORM-based $patron->permissions()
4. Helper compatibility - Works with existing _dispatch() logic

The logging functionality still works correctly - the diff will now
show explicit changes from 0 to 1 rather than absence to presence.

Test plan:
1. prove t/db_dependent/Koha/Patron.t
2. prove t/db_dependent/Log.t
3. Verify all tests pass
4. Confirm permissions() now returns all flags with 0/1 values

Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to