Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API Add all users to room #3569

Merged
merged 6 commits into from
Jun 17, 2016

Conversation

Deepakkothandan
Copy link
Contributor

@RocketChat/core

Rest API method to add all existing users to a Channel

@Deepakkothandan Deepakkothandan changed the title Add all users to room REST API Add all users to room Jun 15, 2016
@Deepakkothandan
Copy link
Contributor Author

@geekgonecrazy This PR adds a method which provides the functionality to add all existing users to a newly create Channel. At present, it is not possible to add all existing users to a newly created channel. Please review the PR and provide your suggestions

@geekgonecrazy
Copy link
Contributor

@Deepakkothandan thanks for contributing! We'll take a look.

At first glance though this makes me very nervous.... On our demo server we have 60k+ users. If we add all of those to a channel... That could potentially be a very costly operation.

@Deepakkothandan
Copy link
Contributor Author

@geekgonecrazy Yeah I understand, that with a huge amount of users this could be expensive and that's the reason why only admins are allowed to do this. There are occasions, where one need to create a new channel with all existing user. Would be nice to have this feature

@Sing-Li
Copy link
Member

Sing-Li commented Jun 16, 2016

@Deepakkothandan nvm. missed that it was REST-API.

I would still suggest adding a group of Settings that limits (by default) the API call if the count of users are above a reasonable threshold.

This will allow the admin (with GUI access) to explicitly override the system if necessary. And be somewhat proofed to DoS attacks via REST.

@Deepakkothandan
Copy link
Contributor Author

@Sing-Li Thank you for your suggestions, Added a condition if the count exceeds 500, then the call would return a error. I believe its a reasonable amount. Please provide your thoughts.

@engelgabriel
Copy link
Member

@RocketChat/core is this ready to merge?

@Sing-Li
Copy link
Member

Sing-Li commented Jun 16, 2016

@Deepakkothandan really thank you for your contributions.

LGTM

@geekgonecrazy
Copy link
Contributor

geekgonecrazy commented Jun 17, 2016

@Deepakkothandan thanks for making those changes, and thanks again for the contribution. 😄

@sampaiodiego
Copy link
Member

So, I see two problems here:

  • The file server/methods/addAllUserToRoom.js is using two spaces for indentation instead of tabs. Please run eslint ., it should return no errors..
  • The admin validation is done only on the REST endpoint, but the method is unprotected.

@Deepakkothandan can you please fix the issues above? Thank you again for the contribution =)

@geekgonecrazy
Copy link
Contributor

geekgonecrazy commented Jun 17, 2016

Ah! I missed that. Yes for sure if you could address those. The method needs validation because it could potentially be called from the client by unauthorized user otherwise

@Deepakkothandan
Copy link
Contributor Author

Thank you all for reviewing the PR. @sampaiodiego Updated the PR as per your suggestions.

@sampaiodiego
Copy link
Member

thanks @Deepakkothandan

Maybe I wasn't clear enough, sorry about that 😞

But on the REST route you have a validation to see if the user is an admin.. this validation have to be done in the Meteor method instead of the REST endpoint, because the method can be called directly from the client and the REST endpoint also call it.

@Deepakkothandan
Copy link
Contributor Author

@sampaiodiego Thank you for the clarification, I made the required changes.

@sampaiodiego sampaiodiego merged commit 073ed64 into RocketChat:develop Jun 17, 2016
Gudii added a commit to Gudii/Rocket.Chat that referenced this pull request Jul 1, 2016
…nto develop

* 'develop' of https://github.com/RocketChat/Rocket.Chat: (210 commits)
  Save room topic escaped
  Update references from ES2016 to ECMAScript 2015
  REST API Add all users to room (RocketChat#3569)
  Use .eslintc file instead of .eslintrc.js
  Update settings.js
  Restore watermark
  Add eslint and ES2016 to contributing guide
  Fix eslint errors
  Fix Ubuntu link closes 3575
  Update more links to current documentation
  Fixes RocketChat#3571: sort slash commands before filtering
  Rename settings group
  Lingohub (RocketChat#3562)
  Remove unused method
  User findOneByEmailAddress case insensitive
  fixes language_version on catalan translation
  fixes language_version on spanish translation
  version bump to 0.34.0
  Add "How it all started"
  Fix issue with updateTimeout using rid out of context
  ...

# Conflicts:
#	packages/rocketchat-theme/assets/stylesheets/base.less
#	packages/rocketchat-ui-login/login/form.coffee
#	packages/rocketchat-ui-sidenav/side-nav/sideNav.html
@engelgabriel engelgabriel added this to the 0.35.0 milestone Jul 13, 2016
@paradisetradingsolutions

how is this progress going? Ability to add all existing users to a channel is a great feature, (many competitors are missing) and very needed for our group!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants