Files
newznab-tmux-NNTmux/app/Models
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-03-11 10:11:30 +01:00
2026-05-30 23:31:00 +02:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00
2026-02-26 14:26:07 +01:00
2026-04-23 14:51:59 +02:00
2026-06-12 10:11:15 +02:00
2026-02-26 14:26:07 +01:00
2026-05-30 23:31:00 +02:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-06-17 09:49:39 +02:00
2026-06-22 21:24:58 +02:00
2026-06-17 09:49:39 +02:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00
2026-02-26 14:26:07 +01:00
2026-04-09 17:16:17 +02:00
2026-02-26 14:26:07 +01:00
2026-02-26 14:26:07 +01:00
2026-03-11 10:11:30 +01:00
2026-05-22 15:24:55 +02:00
2026-03-11 10:11:30 +01:00
2026-06-12 10:11:15 +02:00
2026-05-08 18:52:14 +02:00
2026-05-30 23:31:00 +02:00
2026-03-11 10:11:30 +01:00
2026-06-08 16:31:15 +02:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00
2026-03-11 10:11:30 +01:00
2026-04-01 12:54:16 +02:00
2026-02-26 14:26:07 +01:00
2026-02-26 14:26:07 +01:00
2026-02-26 14:26:07 +01:00
2026-06-11 10:32:38 +02:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00
2026-03-11 10:11:30 +01:00
2026-04-27 17:00:41 +02:00
2026-04-30 16:45:15 +02:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-04-09 17:16:17 +02:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-03-11 10:11:30 +01:00
2026-06-26 23:19:30 +02:00
2026-03-11 10:11:30 +01:00
2026-02-26 14:26:07 +01:00