Skip to content

Fix: Guard context access in PermissionService.hasPermission - #104

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/guard-permission-context
Open

Fix: Guard context access in PermissionService.hasPermission#104
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/guard-permission-context

Conversation

@sentry

@sentry sentry Bot commented Jul 9, 2026

Copy link
Copy Markdown

This PR addresses a TypeError: Cannot read properties of undefined (reading 'companyId') occurring in PermissionService.hasPermission.

The root cause was that the context parameter in hasPermission is optional, but context.companyId was accessed directly without a null check. When hasPermission was called from templates without a context argument, context would be undefined, leading to the TypeError.

The fix implements optional chaining (context?.companyId) on line 37 of src/app/providers/permission.service.ts. This ensures that companyId is only accessed if context is defined, preventing the application from crashing when context is undefined.

Fixes SH-STAFF-APP-5
Fixes TECH-2025

@linear-code

linear-code Bot commented Jul 9, 2026

Copy link
Copy Markdown

TECH-2025

@netlify

netlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy Preview for studenthub-staff ready!

Name Link
🔨 Latest commit a60d6ad
🔍 Latest deploy log https://app.netlify.com/projects/studenthub-staff/deploys/6a5028dced187a000885d01b
😎 Deploy Preview https://deploy-preview-104--studenthub-staff.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants