Approaching a restricted chat use-case



I’ve got a use-case here which I’m not entirely sure how to approach.
One part of the application that I’m building involves a chat between the users and the admin.


Admin can create a chat between the admin and a user
Admin can create a chat between the admin and multiple users
User can create a chat between the admin and the user itself.

I’ve looked into Meteor-roles package to see if there’s anything i can make use of in there but I’m not entirely sure on how to approach this certain use-case when it comes to handling sub/pubs.
Something tells me it’s a matter of checking which role the current user has that wants to create a new chat - as well as pointing them to the user-id to set up a connection between them.

Any pointers?


Basically it’s really really simple, I don’t even think you need any packages for that. Just set a flag on the admin user so you know it’s an admin, all other users are just regular users.

And then you check for that admin flag on the user everywhere it matters, i.e. every time someone wants to open a new chat, which should be just a single Meteor method (or allow/deny rule(s), if you prefer it that way). And then also in the UI for displaying a link or button for opening a new chat window.
And pubs/subs wouldn’t even have to check the flag, except one pub/sub pair maybe for the admin that lists all the available users to the admin user. The other pub/subs can simply send all channels & messages for the current user.

And that’s it. Get started with it, ask more specific questions if you encounter some. It’s really straightforward.


Cheers :slight_smile: sorry for a late respons. Had a busy time working on other features of the app but I have now come back to the chat.

Question: how would you do the chat assignment? Is it possible to do something to grab a users id from a list using something like the autoform package? I saw a similar post on reddit but no clear answer