[NEW] Implementation of the User create Interface in Apps.engine#15209
[NEW] Implementation of the User create Interface in Apps.engine#15209Cool-fire wants to merge 1 commit intoRocketChat:developfrom Cool-fire:create-bot-user
Conversation
| user.joinDefaultChannels = true; | ||
| } | ||
|
|
||
| Roles.findUsersInRole('admin').forEach((adminUser) => { |
There was a problem hiding this comment.
Why the loop through each user who has an admin role? What if there are ten of them, wouldn't this code run multiple times and result in several users being defined or errors happening?
Also, @RocketChat/backend how should we handle the Apps creating users? Ideally we don't want to "associate" the user being created to an admin user who didn't actually create the new user.
There was a problem hiding this comment.
@graywolf336 while creating rocket.cat also uses same type of loop, but since the rocket.cat is created at begining there is only single admin,but in this case as you said there can be multiple admins, which may lead to errors. My bad @graywolf336, can you please suggest how ideally the bots should be created in the server without getting errors.
There was a problem hiding this comment.
Until we hear back from @RocketChat/backend about what to do, just get any admin user and use them.
There was a problem hiding this comment.
Also, @RocketChat/backend how should we handle the Apps creating users? Ideally we don't want to "associate" the user being created to an admin user who didn't actually create the new user.
actually this admin user is just used for validation purposes.. for now it will not be associated and I think it is fine to do what @graywolf336 said, just get any admin and use it.
| async create(user, appId) { | ||
| this.orch.debugLog(`The App ${ appId } is requesting to create a new user`); | ||
|
|
||
| user.password = 'pass'; |
There was a problem hiding this comment.
is there any purpose by having a fixed password? I'd recommend using a random password and having that password sent via email.
| user.password = 'pass'; | |
| user.password = Random.id(); |
There was a problem hiding this comment.
@sampaiodiego The idea was to have a fixed password, and when the bot logs in for the first time it has to change the password since user.requirePasswordChange is set to true. This way we don't have to send the mail to the bot email. @graywolf336 @sampaiodiego Your thoughts??
|
|
||
| import { saveUser } from '../../../lib/server/functions/saveUser'; | ||
| import { Users } from '../../../models/server'; | ||
| import { Roles } from '../../../models'; |
There was a problem hiding this comment.
as suggested above
| import { Roles } from '../../../models'; |
| import { Meteor } from 'meteor/meteor'; | ||
|
|
||
| import { saveUser } from '../../../lib/server/functions/saveUser'; | ||
| import { Users } from '../../../models/server'; |
There was a problem hiding this comment.
You can import Roles model from here
| import { Users } from '../../../models/server'; | |
| import { Users, Roles } from '../../../models/server'; |
|
We've merged part of this implementation on #15896 along with its Apps-Engine counterpart. Thank you so much @Cool-fire for starting this, helped us a lot! 😃 |
No description provided.