Files
newznab-tmux/tests/Feature
joemeyer76 e62724f2cd Fix getCategoryExclusionById() excluding every category for role-only users
RolesAndPermissionsSeeder grants every 'view *' permission via
Role::givePermissionTo() only -- it never grants permissions directly to a
user with User::givePermissionTo(). That is true for every seeded role,
including Admin.

User::getCategoryExclusionById() computed the allowed permission set as:

    $userAllowed = $user->getDirectPermissions()->pluck('name')->toArray();
    $roleAllowed = $user->getAllPermissions()->pluck('name')->toArray();
    $allowed = array_intersect($roleAllowed, $userAllowed);

getAllPermissions() already includes permissions granted via the user's
role(s), so intersecting it with getDirectPermissions() (permissions
assigned directly to the user, bypassing roles) means $allowed is empty
for any user whose permissions come only from their role. Since every
seeded role works this way, this silently excluded every category root
for every user on a fresh install, and any subsequent Newznab/Torznab API
search or browse request returned zero results with no visible error.

Fix: use getAllPermissions() directly, since it already reflects both
role-granted and directly-granted permissions.

Added a regression test (test_role_only_permissions_are_not_excluded)
that mirrors the real seeder setup -- role-only permissions, nothing
granted directly to the user -- to make sure this doesn't regress.
2026-07-03 18:18:46 -04:00
..
2026-06-15 12:31:39 +02:00
2026-06-12 10:11:15 +02:00
2026-03-30 16:20:52 +02:00
2026-07-02 11:43:08 +02:00
2026-06-15 01:26:34 +02:00
2026-04-30 16:45:15 +02:00
2026-04-30 16:45:15 +02:00
2026-04-28 10:59:45 +02:00
2026-03-11 10:11:30 +01:00
2026-03-26 11:43:32 +01:00
2026-01-07 14:51:28 +01:00
2026-06-17 09:49:39 +02:00
2026-04-28 15:29:06 +02:00
2026-06-17 13:34:13 +02:00
2026-01-07 14:51:28 +01:00
2026-03-26 11:43:32 +01:00
2024-11-28 14:10:08 +01:00
2026-03-11 10:11:30 +01:00
2026-01-07 14:51:28 +01:00
2026-02-13 14:20:45 +01:00
2026-01-07 14:51:28 +01:00
2026-04-23 00:18:36 +02:00
2026-01-27 16:36:03 +01:00