RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Teams logic with apps engine

inaferando opened this issue · comments

We use single Rocket Chat instance to communicate with several user teams. Our main requirement is that users from different teams should not be able to create chats with each other. Still, there are some admin-like users that can find any user from any team and start chat with him. The information about team is included into user name like "team1_user1", "team1_user2" etc. Admin users have no "teamX_" component in the user name.

RC has no such functionality out of box. To achieve our requirements we edit the source code and prepare custom build.

We edit the following core functions

findByNameAndTypesNotContainingUsername()
findUsersNotOffline()
findByActiveUsersExcept()

and some modules that invoke these function.
Currently Apps engine does not allow to override these functions. Can it be done in future?

Also there is an old issue related to this topic:
RocketChat/Rocket.Chat#658

Probably teams functionality will not be implemented in the core RC because there is no global understanding how it should work. So, we're looking for more flexible (that code edit) way to apply our patch.

Could you use the custom data for each user and then listen to the room events? Or if you went full out Apps, you could store all the data as persistent data in the App and then just listen and prevent users creating rooms with other team members.

It could require adding new events for when a new room is creating, but that wouldn't be hard in adding to the Apps framework.

Prevent creating rooms between users from different teams is necessary, but not enough. We'd like to listen and override server response when some user is searching for another user. In fact, we want to override database query to narrow the search to one team. Is it possible with Realtime API or Apps engine @graywolf336 ?