Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

😂 Bro was too tempted by the pretty girls he had to check it out even tho he knew it was a scam

Yeah bots probably gone never tbh. RIP

I support this request

Let him keep the server clean

scope: spam

Someone once told me that people do fall for it. I don't think anyone falls for it in this type of discord server tho

I love how discord bans people for sharing malware snippets in technical, intellectual contexts (not malicious), but can't auto ban these scammers instantly

Also @hsluoyz you know ReBAC is possible with casbin if you just simply have an external relationship system? Might be worth adding that to the README's

just to clarify, i meant "but there's definitely many use cases for each tenant having separate policies*"

the policy is not the same thing as the model. The model defines what the policy means, while the policy is dynamic and rules can be added/deleted whenever.

I don't think there's much use case for having each tenant have a separate model, but there's definitely many use cases for each tenant having separate policies*

Also, if you really do need the model to change, a sub-ms latency is perfectly fine since like you said, it won't happen very often. Model changes would always happen a lot less often than policy changes I'd think

And I think the best option if you need to swap models is to have a map[key]enforcer

If that's the case, we could add another method something like GetStrictFilteredPolicy which would treat "" as empty string, "*" as wildcard

If you're gonna support empty strings in the adapters (as has been discussed), the GetFilteredPolicy method should support that, in my opinion.

interesting. Idk why a custom claim call would be needed to get a user's roles tho

I'd think there'd be a built-in way of doing it

idk what casdoor is but I assume there's a way to get the user's roles built in

why do you need a 'custom claim'

(I just use casbin)

why don't you just use "get implicit roles for user"

That's incorrect. AI is wrong

casbin checks if a user has a role by looking in the database for a g, [userUUID], [role] rule

g means grouping I think

For example you want to check if a user has the role "admin":
userUUID = 1234 (just for example)

casbin looks in database for a rule like
g, 1234, admin

So to GIVE a user a role, you just simply need to add a rule to the database via casbin like "g, 1234, admin"

There is no list of roles involved in giving a user a role

For example in Go (language) it would look like this:

enforcer.AddRoleForUser("1234", "admin")

It's probably very similar in whatever language you're using

Ask AI:

How to give user a role in Casbin in [programming language you're using]:
enforcer.AddRoleForUser("1234", "admin")

Why don't you just ask AI

Of course it's possible to give a role to a user

users shouldn't "be in" the roles list, the list of roles is for roles

users should HAVE roles but users AREN'T roles themselves

giving a user a role looks like this in the database usually

g, [userUUID], role

So to give a user a role, you just simply create a rule in the database via casbin that says "g, [userUUID], role"

You don't "add a user to the list of roles"

sweet, thanks for that. I didn't want to have to fix it myself