Does the sdk provide any method to format permissions? the permissions return object shows them currently as complete strings, if not whats a good alternative for now?
We don't have a good solution for this, beside parsing them unless @Meldiron or @Steven have some ideas.
Anyways, this is something we really want to improve, how would you expect the SDK to handle this? Would some extra methods help? which?
Hey 👋 I cant think of any simple way from top of my head. Extra question, what is your use case - why do you need to parse them? Ideally you should not be required to work with those.
im thinking of using regex expressions but thinking further they dont come in expected orders
i want to show ui content for perms + roles
That sounds reasonable. Well this is the structure:
TYPE("ROLE")
Where TYPE
can be read,write,create,update,delete
and role can be:
any
guests
users
orusers/USER_ID
orusers/USER_ID:STATUS
(status can beverified
orunverified
)member:MEMBERSHIP_ID
team:TEAM_ID
orteam:TEAM_ID/ROLE
Does that help? parsing with regex should be a good way to separate type and role. From there, you check what kind of role you have with a few ifs
These 2 files are how we build the string, it can help to get the full picture:
you are awesome thanks
@Eldad @Meldiron @Steven this can be refined in many ways but ill leave that up for you guys to decide i gotta work on my project :appwriteheart2: just make sure to keep the iserror value and turn it to true when there is an actual error.
[SOLVED] Format permissions individually
Recommended threads
- Current User is Not authorized
recreating same Thread
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...