Skip to content

Permissions and security ​

What is checked. Each page renders an encrypted token that expires. Every sync request checks the user, panel, tenant, room scope and record again, and asks the resource's canEdit() or canView(), so your policies apply. A record that is gone, or out of reach, answers 404, the same as one that never existed.

What is validated. A browser may only change fields its user can edit, only with its own operation ids, and only with allow-listed rich content: attributes like onclick, javascript: links or custom block HTML never reach another browser. A picked field only accepts the options its user was offered. Field names and carets are only sent to people who can see that field.

Know this before enabling it. A shared draft is shared: when you save, you publish what colleagues put in the fields you can edit, validated by your form. Free-text fields have no allow-list, so if only some people may change a field at all, give the others ->disabled() or ->collaborative(false).

Who may edit live. Whoever may edit a record may collaborate on it, unless your policy says otherwise with a collaborate ability. Those it refuses still edit the record, see who is there, and merge on save; they just do not type into the shared draft:

php
class PostPolicy
{
    public function collaborate(User $user, Post $post): bool
    {
        return ! $user->is_reviewer;
    }
}

Gate::define('collaborate', ...) works too. It is checked on every sync, so withdrawing it takes effect on the next request: the page renders again without live fields. Permissions::mayCollaborate($post) asks the same question in your own code.

After changing roles or field access, tell open tabs to fetch a new token:

php
use SolutionForest\FilamentCollaboration\Permissions;

Permissions::changed($post); // people on this record
Permissions::changed();      // everybody

or from the command line: php artisan filament-collaboration:refresh-permissions. Open tabs re-render on their next sync, at once with Reverb. Without it, tokens renew within 15 minutes. Revoking access to the record itself takes effect on the next request.

Released under the MIT License.