Skip to content

Instantly share code, notes, and snippets.

View tfevan's full-sized avatar
✍️
Focusing Laravel, TailwindCSS, VueJS

Talha F. tfevan

✍️
Focusing Laravel, TailwindCSS, VueJS
View GitHub Profile
@mtvbrianking
mtvbrianking / casl-backend-permission-2.js
Last active July 17, 2025 17:02
CASL load user permissions from API on login
import { Ability, subject } from "@casl/ability";
const editorRole = { id: 1, name: 'Editor'};
const adminRole = { id: 2, name: 'Admin' };
const user = { id: 1, alias: "jdoe", name: "John Doe", role_id: 1 };
const ability = new Ability();
const rules = [
{