Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request]: allow policy-based context menu actions with event type detection #62

Open
Gonzalo2683 opened this issue Jan 13, 2025 · 0 comments

Comments

@Gonzalo2683
Copy link

What feature would you like to add?

What we need to achieve is that when clicking on a calendar event, the context menu should display actions based on the user's policies/permissions for that particular model type. For example, a user with "view_activity" but not "edit_activity" permissions should only see the view action when clicking on an Activity event(model).

I'm not sure if there's a way to access the event model type before the record is loaded - if there is, I'd appreciate guidance on how to implement this. This would allow proper integration with Laravel's policy system for granular permission control.

Currently calendar context menu actions (view/edit/delete) are always shown regardless of user permissions. This leads to two issues:

  1. Actions are visible even when users lack permissions
  2. The getEventRecord() method returns null on initial load, making it impossible to check model type for permission validation

We need a mechanism to:

  • Identify event model type before showing actions
  • Hide/show actions based on model policies

Example of current limitation:

public function getEventClickContextMenuActions(): array 
{
   $event = $this->getEventRecord(); // Returns null initially
   // Cannot determine if event is A/B
   // Cannot check appropriate policies
}

### Notes

_No response_
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

No branches or pull requests

1 participant