From 6bb65ef420fba17ec02e9b8005ca58bb60321cdc Mon Sep 17 00:00:00 2001
From: George Goldberg <george@gberg.me>
Date: Tue, 4 Apr 2017 19:43:22 +0100
Subject: PLT-6139 (WebApp): Manage Private Channel Members (#5947)

Honour the policy setting for add/remove members from private channels
in the WebApp UI.
---
 .../components/admin_console/policy_settings.jsx   | 27 +++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

(limited to 'webapp/components/admin_console/policy_settings.jsx')

diff --git a/webapp/components/admin_console/policy_settings.jsx b/webapp/components/admin_console/policy_settings.jsx
index 13101e828..471d2d336 100644
--- a/webapp/components/admin_console/policy_settings.jsx
+++ b/webapp/components/admin_console/policy_settings.jsx
@@ -34,6 +34,7 @@ export default class PolicySettings extends AdminSettings {
         config.TeamSettings.RestrictPrivateChannelManagement = this.state.restrictPrivateChannelManagement;
         config.TeamSettings.RestrictPublicChannelDeletion = this.state.restrictPublicChannelDeletion;
         config.TeamSettings.RestrictPrivateChannelDeletion = this.state.restrictPrivateChannelDeletion;
+        config.TeamSettings.RestrictPrivateChannelManageMembers = this.state.restrictPrivateChannelManageMembers;
 
         return config;
     }
@@ -49,7 +50,8 @@ export default class PolicySettings extends AdminSettings {
             restrictPublicChannelManagement: config.TeamSettings.RestrictPublicChannelManagement,
             restrictPrivateChannelManagement: config.TeamSettings.RestrictPrivateChannelManagement,
             restrictPublicChannelDeletion: config.TeamSettings.RestrictPublicChannelDeletion,
-            restrictPrivateChannelDeletion: config.TeamSettings.RestrictPrivateChannelDeletion
+            restrictPrivateChannelDeletion: config.TeamSettings.RestrictPrivateChannelDeletion,
+            restrictPrivateChannelManageMembers: config.TeamSettings.RestrictPrivateChannelManageMembers
         };
     }
 
@@ -214,6 +216,29 @@ export default class PolicySettings extends AdminSettings {
                         />
                     }
                 />
+                <DropdownSetting
+                    id='restrictPrivateChannelManageMembers'
+                    values={[
+                        {value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAllChannel', 'All channel members')},
+                        {value: Constants.PERMISSIONS_CHANNEL_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsChannelAdmin', 'Channel, Team and System Admins')},
+                        {value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
+                        {value: Constants.PERMISSIONS_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsSystemAdmin', 'System Admins')}
+                    ]}
+                    label={
+                        <FormattedMessage
+                            id='admin.general.policy.restrictPrivateChannelManageMembersTitle'
+                            defaultMessage='Enable managing of private group members for:'
+                        />
+                    }
+                    value={this.state.restrictPrivateChannelManageMembers}
+                    onChange={this.handleChange}
+                    helpText={
+                        <FormattedMessage
+                            id='admin.general.policy.restrictPrivateChannelManageMembersDescription'
+                            defaultMessage='Set policy on who can add and remove members from private groups.'
+                        />
+                    }
+                />
                 <DropdownSetting
                     id='restrictPrivateChannelDeletion'
                     values={[
-- 
cgit v1.2.3-1-g7c22

