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:
anyguestsusersorusers/USER_IDorusers/USER_ID:STATUS(status can beverifiedorunverified)member:MEMBERSHIP_IDteam:TEAM_IDorteam: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
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- RowList: The value of total is coming as...
RowList: The value of total is coming as a String, so it throws an error because it’s not parsed into an int. Error: TypeError: \"37\": type 'String' is not a ...
- [SOLVED] curl error Number: 6 — function...
Hello, I invested a lot of time in this error in a fresh install of appwrite 1.8.1 and lasted until fix, this if for helping anyone that can have the same weird...