Skip to content

Default oauth role#6028

Merged
rodrigok merged 3 commits into
developfrom
default-oauth-role
Feb 16, 2017
Merged

Default oauth role#6028
rodrigok merged 3 commits into
developfrom
default-oauth-role

Conversation

@marceloschmidt

Copy link
Copy Markdown
Member

@RocketChat/core

Closes #5842

image

Comment thread server/lib/accounts.js Outdated

delete user.globalRoles;

if (!(user.services && user.services.password)) {

Copy link
Copy Markdown
Member

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) {

Comment thread server/lib/accounts.js Outdated
delete user.globalRoles;

if (!(user.services && user.services.password)) {
const defaultAuthServiceRoles = (RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Default_Roles') + '').split(',');

Copy link
Copy Markdown
Member

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?

Comment thread 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));

Copy link
Copy Markdown
Member

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()));

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Specify default role for OAuth users

3 participants