[PLT-6838] Restrict channel delete option per permission policy even for last channel member (#6706)

* channel delete option is hidden from the menu unless there is appropriate permissions as set in the policy page

* apply to public channel only and add restriction to API layer

* updated channel deletion
Этот коммит содержится в:
Saturnino Abril
2017-07-05 06:32:27 +08:00
коммит произвёл GitHub
родитель 6d6ed309b9
Коммит 8f8a978e84
6 изменённых файлов: 45 добавлений и 37 удалений

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

@@ -190,11 +190,15 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin, isChannel
return true;
}
export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin) {
export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin, userCount) {
if (global.window.mm_license.IsLicensed !== 'true') {
return true;
}
if (ChannelStore.isDefault(channel)) {
return false;
}
if (channel.type === Constants.OPEN_CHANNEL) {
if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
return false;
@@ -206,6 +210,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin
return false;
}
} else if (channel.type === Constants.PRIVATE_CHANNEL) {
if (userCount === 1) {
return true;
}
if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
return false;
}