OpenSaas setting up teams?
Can anyone tell me how difficult it is to set up teams and team subscriptions with the OpenSaaS template?
2 Replies
Hi @randopixel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Setting up teams or groups in the OpenSaaS template involves introducing a new entity, such as
UserGroup
or Org
, and then establishing a many-to-many relation between this entity and the User
entity. This way, you can check if a user belongs to the appropriate group when trying to access a resource.
If you only need a few fixed roles, you can introduce a role
field on the User
entity and check its value. If these roles should be managed by another user, like an admin, you could make them dynamic by having an entity Role
and assigning those to Users.
Here's a general idea of how you might set up a UserGroup
:
And then in your User
entity:
Remember, this is just a general idea and you'll need to adapt it to your specific needs. This isn't something specific to Wasp, but rather a normal app/database design task.
For more information, you can refer to the Wasp documentation (https://wasp-lang.dev/docs/data-model/backends#seeding-the-database) or ask for help in the Wasp community.
Source: Discord support thread: Teams/Groups > Answers (https://discord.com/channels/686873244791210014/1213121869507592244)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @randopixel, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Yeah, that is business logic -> shouldn't be hard per se, just work to define this stuff correctly!