RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.
https://rocketchat.github.io/Rocket.Chat.Apps-engine/
MIT License
116 stars 119 forks source link

Teams logic with apps engine #119

Open inaferando opened 5 years ago

inaferando commented 5 years ago

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", "team1user2" 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: https://github.com/RocketChat/Rocket.Chat/issues/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.

graywolf336 commented 5 years ago

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.

inaferando commented 5 years ago

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 ?