Forums Feature Requests Thread

[Enhancement] mobieusHelp: Orphaned method HelpdeskContext::hasAnyRole() — the only role-check helper on the class, never called

Patrick Bass · Jun 6 · 21 · 1 Locked
[Normal Priority] [Feature Enhancement] [Deployed to Production]
🚀 OP Jun 6, 2026 6:25pm

Area: mobieusHelp (audit p7) · Surface: platform/src/Services/Helpdesk/HelpdeskContext.php · Dimension: dead-code · Severity: minor

HelpdeskContext exposes hasAnyRole(...$slugs) as its role-membership check, but helpdesk authorization actually flows through HelpdeskPermissions::can() and the $ctx->roles array is consumed directly elsewhere. No code calls $ctx->hasAnyRole(). It is a dead public accessor.

Evidence

Definition at platform/src/Services/Helpdesk/HelpdeskContext.php:73 `public function hasAnyRole(string ...$slugs): bool`. Scoped grep across helpdesk controllers + services finds zero callers: `grep -rn "hasAnyRole" platform/src/Controllers/Helpdesk platform/src/Services/Helpdesk | grep -v "function hasAnyRole"` => 0. The only other hasAnyRole in the repo is an unrelated class (platform/src/Services/Learn/LearnContext.php:72). Sibling HelpdeskContext methods ARE used: tenantEligible() (HealthController.php), actorPair() (HelpdeskAudit.php).

Suggested fix. Delete hasAnyRole() from HelpdeskContext, or refactor the permission/role checks that read $ctx->roles directly to go through it for consistency.

Filed by the automated tenant-app audit and adversarially evidence-verified. Status: verified. Open — not yet actioned.


Patrick Bass
@mobieus

🚀 Jun 7, 2026 12:51pm

Shipped and deployed to production. Commit 63b2de429a.

HelpdeskContext::hasAnyRole() marked @deprecated + LogicException.

Closed as: deployed.


Patrick Bass
@mobieus

Log in or register to reply to this thread.