* MM-15059: Restict the permissions for guests (#2791) * MM-15057: Adding guest badge to identify guest users (#2774) * MM-15057: Adding guest badge to identify guest users * Adding Guest tags in the channel title * Adding i18n translations * Adding DM and GM guest warnings * Fixing check-style * Adding and fixing tests * Adding i18n text * Only showing the subtitle when there is enough space * Addressing new design changes * Fixing eslint * Addressing PR comments * Moving getChannelStats to the handleSelectChannel action * Adding the guest info in android landscape channel headers * simplified the guest warning text generation * Fixing i18n * Fixing leaving channel behavior for guests (#2989) * Fixing leaving channel behavior for guests * Fixing tests and adding a new one * fixing typo * Addressing PR comments * Addressing PR comments * Fixing tests
23 lines
537 B
JavaScript
23 lines
537 B
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
// @flow
|
|
|
|
export function isInRole(roles, inRole) {
|
|
if (roles) {
|
|
var parts = roles.split(' ');
|
|
for (var i = 0; i < parts.length; i++) {
|
|
if (parts[i] === inRole) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export function isGuest(user) {
|
|
if (user && user.roles && isInRole(user.roles, 'system_guest')) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|