Even being owner, getting YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION

I defined owner permission set as
export const ownerRole = accessControl.newRole({
customer: ["create", "read", "update", "delete"],
product: ["create", "read", "update", "delete"],
job: ["create", "read", "update", "assign", "delete"],
// user: ["create", "delete"],
// session: ["revoke", "list", "delete"],
...adminAc.statements,

});
export const ownerRole = accessControl.newRole({
customer: ["create", "read", "update", "delete"],
product: ["create", "read", "update", "delete"],
job: ["create", "read", "update", "assign", "delete"],
// user: ["create", "delete"],
// session: ["revoke", "list", "delete"],
...adminAc.statements,

});
But event being owner of said organization, I am not able to invite admin to join the organization. following returns 403 and above error

const responseOfInviteMember = await organization.inviteMember({
email: values.email,
role: "admin",
organizationId: values.organizationId,
});

const responseOfInviteMember = await organization.inviteMember({
email: values.email,
role: "admin",
organizationId: values.organizationId,
});
Solution:
got it sorted Ping, I guess, from now onwards, we have to explicitly specify invitation: ["create"] in permissions set, and it is not part of defaultStatements , I am happy to add this explicitly, I am good now.
Jump to solution
6 Replies
Ping
Ping6d ago
What version are you on?
anand248
anand248OP6d ago
I was on 1.2.4, just upgraded again to 1.2.5 and tested again, the same error. This issue was not there till recently. Thanks for looking into it. Admin is also not being able to invite members.
Ping
Ping6d ago
I do believe I had a recent PR merge to fix this. It relates to admin plugin not actually using the AC you define. Might have to wait until next release for it to work.
anand248
anand248OP5d ago
Thanks, I could not find any such PR - https://github.com/better-auth/better-auth/pulls?q=is%3Apr+is%3Aclosed Could you please share the PR link, I will try to add my own else.
GitHub
Pull requests · better-auth/better-auth
The most comprehensive authentication framework for TypeScript - Pull requests · better-auth/better-auth
Solution
anand248
anand2485d ago
got it sorted Ping, I guess, from now onwards, we have to explicitly specify invitation: ["create"] in permissions set, and it is not part of defaultStatements , I am happy to add this explicitly, I am good now.
Ping
Ping5d ago
Okay gotcha

Did you find this page helpful?