-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
Default oauth role #6028
Default oauth role #6028
Conversation
server/lib/accounts.js
Outdated
@@ -95,6 +95,13 @@ Accounts.insertUserDoc = _.wrap(Accounts.insertUserDoc, function(insertUserDoc, | |||
|
|||
delete user.globalRoles; | |||
|
|||
if (!(user.services && user.services.password)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little bit confused to me, why not:
if (!user.services || !user.services.password) {
server/lib/accounts.js
Outdated
@@ -95,6 +95,13 @@ Accounts.insertUserDoc = _.wrap(Accounts.insertUserDoc, function(insertUserDoc, | |||
|
|||
delete user.globalRoles; | |||
|
|||
if (!(user.services && user.services.password)) { | |||
const defaultAuthServiceRoles = (RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Default_Roles') + '').split(','); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks less hack:
const defaultAuthServiceRoles = String(RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Default_Roles')).split(',');
What do you think?
server/lib/accounts.js
Outdated
if (!(user.services && user.services.password)) { | ||
const defaultAuthServiceRoles = (RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Default_Roles') + '').split(','); | ||
if (defaultAuthServiceRoles.length > 0) { | ||
roles = roles.concat(_.map(defaultAuthServiceRoles, s.trim)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets try to prevent use underscore when we have native functions?
roles = roles.concat(defaultAuthServiceRoles.map(i => i.trim()));
@RocketChat/core
Closes #5842