Overview
The Discord Webhook Manager implements a granular role-based permission system that allows webhook owners to control what collaborators can do. There are three distinct permission levels, each with specific capabilities.The webhook owner always has full control and is not affected by permission levels. Permission levels only apply to collaborators.
Permission Levels
For Webhooks
Webhooks support three permission levels defined in the database schema:Admin
Full management capabilities including inviting others and modifying settings.
Editor
Can edit webhook configuration and send messages but cannot manage collaborators.
Viewer
Read-only access to view webhook details and message history.
For Templates
Templates use a simplified two-level permission system:Edit
Can modify template content and configuration.
View
Read-only access to view and use templates.
Detailed Permission Matrix
Webhook Permissions
| Action | Owner | Admin | Editor | Viewer |
|---|---|---|---|---|
| View webhook details | ✅ | ✅ | ✅ | ✅ |
| View message history | ✅ | ✅ | ✅ | ✅ |
| Send messages | ✅ | ✅ | ✅ | ❌ |
| Edit webhook settings | ✅ | ✅ | ✅ | ❌ |
| Delete webhook | ✅ | ❌ | ❌ | ❌ |
| Invite collaborators | ✅ | ✅ | ❌ | ❌ |
| Remove collaborators | ✅ | ✅ | ❌ | ❌ |
| Change permissions | ✅ | ✅ | ❌ | ❌ |
| Leave webhook | ❌ | ✅ | ✅ | ✅ |
Template Permissions
| Action | Owner | Edit | View |
|---|---|---|---|
| View template | ✅ | ✅ | ✅ |
| Use template | ✅ | ✅ | ✅ |
| Edit template | ✅ | ✅ | ❌ |
| Delete template | ✅ | ❌ | ❌ |
| Share template | ✅ | ❌ | ❌ |
Authorization Implementation
Managing Collaborators
The system uses Laravel’s authorization policies to check permissions:- View the collaborators list
- Send invitations
- Update permission levels
- Remove collaborators
Viewing Collaborators
When viewing collaborators, the system loads all relevant relationships:Updating Permission Levels
Admins and owners can change a collaborator’s permission level:The system validates that the collaborator belongs to the webhook before updating to prevent unauthorized permission changes.
Leaving Webhooks
Collaborators (but not owners) can voluntarily leave a webhook:Removing Collaborators
Owners and admins can remove collaborators:Database Schema
Webhook Collaborators
Template Collaborators
Model Relationships
TheWebhookCollaborator model defines important relationships:
- Loading webhook details for collaborators
- Accessing user information for display
- Tracking who invited each collaborator
Permission Metadata
The system tracks additional metadata for audit purposes:invited_by
invited_by
Tracks which user sent the invitation, enabling audit trails and preventing unauthorized invitation cancellation.
invited_at
invited_at
Records when the invitation was originally created, useful for security audits.
accepted_at
accepted_at
Tracks when the invitation was accepted, showing when the user officially became a collaborator.
Best Practices
Principle of Least Privilege
Always start with the lowest permission level (Viewer) and upgrade only when necessary.
Regular Audits
Periodically review collaborators and their permission levels to ensure they’re still appropriate.
Admin Sparingly
Only grant Admin permission to truly trusted team members who need to manage collaborators.
Document Roles
Maintain documentation of who has access and why, especially for Admin permissions.
Security Considerations
Unique Constraint: The database enforces a unique constraint on
(webhook_id, user_id), preventing duplicate collaborator records.Authorization Flow
Troubleshooting
Cannot manage collaborators
Cannot manage collaborators
Only webhook owners and users with Admin permission can manage collaborators. Check your permission level in the webhook settings.
Permission changes not taking effect
Permission changes not taking effect
Permission changes are applied immediately. Try refreshing the page or logging out and back in. Check browser cache if issues persist.
Cannot leave webhook
Cannot leave webhook
Only collaborators can leave webhooks. The webhook owner cannot leave their own webhook. If you’re the owner and want to leave, you must transfer ownership (if implemented) or delete the webhook.
Collaborator removed themselves
Collaborator removed themselves
Collaborators can voluntarily leave at any time using the “Leave Webhook” button. This is by design to give users control over their collaborations.
Next Steps
Team Invitations
Learn how to send and manage webhook invitations
Sharing
Best practices for sharing webhooks and templates with teams
