PLT-5080 (WebApp): Channel Admin permission level. (#5047)

* PLT-5080 (WebApp): Channel Admin permission level.

For channel management and channel deletion.

* Fix some incorrect showing/hiding of options.

* Remove incorrect client calls that was overwriting my channel members.
Этот коммит содержится в:
George Goldberg
2017-02-24 01:15:10 +00:00
коммит произвёл Christopher Speller
родитель bc9f3dfa24
Коммит 8509c2f0b0
8 изменённых файлов: 40 добавлений и 11 удалений

Просмотреть файл

@@ -126,7 +126,7 @@ export function showCreateOption(channelType, isAdmin, isSystemAdmin) {
return true;
}
export function showManagementOptions(channel, isAdmin, isSystemAdmin) {
export function showManagementOptions(channel, isAdmin, isSystemAdmin, isChannelAdmin) {
if (global.window.mm_license.IsLicensed !== 'true') {
return true;
}
@@ -138,6 +138,9 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin) {
if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
return false;
}
if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) {
return false;
}
} else if (channel.type === Constants.PRIVATE_CHANNEL) {
if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
return false;
@@ -145,12 +148,15 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin) {
if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
return false;
}
if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) {
return false;
}
}
return true;
}
export function showDeleteOption(channel, isAdmin, isSystemAdmin) {
export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin) {
if (global.window.mm_license.IsLicensed !== 'true') {
return true;
}
@@ -162,6 +168,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin) {
if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
return false;
}
if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) {
return false;
}
} else if (channel.type === Constants.PRIVATE_CHANNEL) {
if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
return false;
@@ -169,6 +178,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin) {
if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
return false;
}
if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) {
return false;
}
}
return true;

Просмотреть файл

@@ -877,6 +877,7 @@ export const Constants = {
LICENSE_EXPIRY_NOTIFICATION: 1000 * 60 * 60 * 24 * 15, // 15 days
LICENSE_GRACE_PERIOD: 1000 * 60 * 60 * 24 * 15, // 15 days
PERMISSIONS_ALL: 'all',
PERMISSIONS_CHANNEL_ADMIN: 'channel_admin',
PERMISSIONS_TEAM_ADMIN: 'team_admin',
PERMISSIONS_SYSTEM_ADMIN: 'system_admin',
PERMISSIONS_DELETE_POST_ALL: 'all',