Different permissions per user

In the admin plugin docs, this is stated.
import { createAccessControl } from "better-auth/plugins/access";

const statement = {
project: ["create", "share", "update", "delete"],
} as const;

const ac = createAccessControl(statement);

const user = ac.newRole({
project: ["create"],
});

const admin = ac.newRole({
project: ["create", "update"],
});

const myCustomRole = ac.newRole({
project: ["create", "update", "delete"],
user: ["ban"],
});
import { createAccessControl } from "better-auth/plugins/access";

const statement = {
project: ["create", "share", "update", "delete"],
} as const;

const ac = createAccessControl(statement);

const user = ac.newRole({
project: ["create"],
});

const admin = ac.newRole({
project: ["create", "update"],
});

const myCustomRole = ac.newRole({
project: ["create", "update", "delete"],
user: ["ban"],
});
But what if I want to assign different attributes per user? Example: user 1 can create project only while user 2 can create and delete. I don't want to create separate roles for that since I may have different combinations. Is that possible with this plugin?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?