Skip to content

Commit

Permalink
Merge pull request #6594 from RocketChat/fix-livechat-guests-getting-…
Browse files Browse the repository at this point in the history
…user-role

[FIX] Do not add default roles for users without services field
  • Loading branch information
engelgabriel authored Apr 4, 2017
2 parents d65e976 + 2d13f07 commit 3da9821
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/lib/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Accounts.insertUserDoc = _.wrap(Accounts.insertUserDoc, function(insertUserDoc,

delete user.globalRoles;

if (!user.services || !user.services.password) {
if (user.services && !user.services.password) {
const defaultAuthServiceRoles = String(RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Default_Roles')).split(',');
if (defaultAuthServiceRoles.length > 0) {
roles = roles.concat(defaultAuthServiceRoles.map(s => s.trim()));
Expand Down

0 comments on commit 3da9821

Please sign in to comment.