Hello everyone,
I am really excited to use Adalo, but I think I am used to normal code design and went into some troubles.
I have a resource (let’s call it Resource
) that can be created by User
and shared to other Users
.
To make it more invite-based, I have created another collection called Shared permissions
. This has columns User
(relation), Resource
(relation) and Accepted
- so that user has to accept the permission first before accessing it.
My first current issue is that I want to create modal while creating or updating a Resource
when owner can basically filter all of the users available in the platform and select those who are invited.
I am adding a list of User
with checkbox that once active creates shared permission record. Issues are:
- Deleting
shared permissions
- I have figured it out by creating invisible screen that basically gets shared permission
from main edit/create modal and deletes it, then goes back from this empty screen. Is there any better way of doing it?
- Making checkbox active/disabled - while it works when modal is opened and I select users there, once I close the modal and re-open it users are (obviously) not selected anymore. Is there any way to make this work? I would normally make a GET query for users that include shared permissions and filter by current
resource
ID.
I would appreciate any help even if it means re-doing the screens from scratch
I still did not find any answer, especially on the other hand doing it with two separate lists is impossible as well. There is no JOIN/UNION etc that would do the thing.
Can anybody give some help?
Can you share some screenshots of your setup? I’m having a bit of trouble picturing it.
Here is the screen, when clicking
+
it should create
Shared permissions
record for given user (its ok), but then go and display
trash
icon that once clicked should delete a shared permission for given user and resource. (tried the same with the checkbox)
Shared resource has one user and one resource
resource can have multiple shared resources and users (through shared resources)
user can have multiple shared resources and resources (through shared resources)
basically it is many-to-many with through
table relation for sharing a resource with other application users.
EDIT: and it is setup like that so I can store accepted_invitation
date.
I was trying a similar setup with simple lists and we may have a bug here with toggles and simple lists. Sorry about that. I filed a ticket for our team. Try using a Custom List with toggles instead. It seems to work!
I tried with custom list without success, it is still missing current resource’s variable when uncheck is triggered + no way of proper setup for active
checkbox state
I might be misunderstanding but I think you just need a Users Collection and a Resources Collection. Just those two. Then access is handled with a many-to-many relationship like in the screenshot below. I have a list of resources, I click on one, fires a modal, then I can give and remove access to each user. Is that what you’re looking for?
I want to explicitly have it with another table so it stores accepted_at date (so the invite must be accepted first)
In this setup I think it is impossible
@adalojosh If there is any other way of designing it like above (so the access is not instant but invite-based) then let me know. I have tried again custom lists and still it is not achievable. I think Adalo should support nested queries, my expectation here was:
- I have a list (custom or simple) of
All Users
(it works)
- When I click on toggle, it creates new
shared permissions
(it works)
- I have option to perform an update/delete by query for a given Resource (does not work - for example, performing deletion/update for a given sharing permission by the user ID and resource ID)
- I have option to custom set toggle value by query (does not work - for example, the value should be picked by some find by current user → ID as sharing permission belongs to user - so current user → ID matching query sharing permission → user → ID)
I made a video outlining how I would create a system like the one you’re describing where users get a list of resources but only after accepting an invite to the resource. Hope this helps!
@adalojosh and anyone interested. The solution - long story short - is about to create direct many-to-many relationship between resource and user and then use invites (has many through relation) as a flow/access control.
This seems to be a not ideal, but at least working solution. While it is from collections and data presentation perspective, the UI that is proposed in this video is far from user-friendly and still not usable. Adding users through dropdown makes it really hard for apps with over 100+ users. One way around it is to probably add text input separately and filter the dropdown or look for custom component dropdown with search. However, there is still an issue with filtering users that are already been invited, which I would describe further below.
To have better user experience, I have tried to again create two lists of resources and manipulating them (since those lists give opportunity to search through resource), although after implementing this collection setup everything stopped working with simple lists - buttons are not doing anything, a lot of issues with displaying data etc. appeared so I switched to custom lists.
I was able to almost fully solve my problem with it, althoutgh then I faced two another problems (I would operate on new design proposed by @adalojosh )
- When searching through
Users
, the list/dropdown/whatever should not display those who already have an Invite
for Current Resource
. This was easy (in theory) to set via filter (Current User
→ Invites
→ Resource
does not contain Current Resource
) but unfortunately this filter never works.
- displaying invites correctly - when I created user dashboard to see the invites, it has to filter with
Current Invite
→ Resource
→ Published
→ true
, but unfortunately this particular filter never works as well. (Removing it displays invites, having it displays nothing - both custom and simple list).
I think that I am making some mistakes in understanding Adalo concepts or platform is just not able to handle such cases.
Oh the UI was just what I tossed together in a few seconds to illustrate the concept of the database structure. You could create a searchable, filtered list of users with a button next to each to send an invite, or any number of other approaches.
@adalojosh the thing is, all of the other built-in elements seems to be bugged. As described above, only custom lists worked to some extent.
Let me know if you run into any bugs, happy to pass them along to my team. The only one I’m aware of at the moment is in some edge cases, a simple list using a toggle might not update the value if the relationship is a many-to-many (even that seems to work in most cases and the workaround if it doesn’t is just to update the other side of the relationship). Thanks.
@adalojosh sure
Invite
→ Resource
filtering does not work
- Simple list actions not working
- Filtering out lists/dropdowns with
contains
on Invite
→ Resource
relation not work
This is what I encountered so far
Sorry you’re running into those issues. It’s hard to tell if those are bugs or incorrect setups without seeing the app. If you’d like us to take a look, please file a ticket with a link to examples and we’ll do what we can. Thanks!
@adalojosh Sorry, but the support stated they are not able to solve technical issues.
For now, this topic still remains unresolved since there is no working solution to the original post, thanks for your help though!