From 8406e854aa912f3d7f9179b10356444f07e25223 Mon Sep 17 00:00:00 2001
From: George Goldberg <george@gberg.me>
Date: Wed, 14 Dec 2016 11:11:51 +0000
Subject: PLT-4332 Position field for Users (#4632)

* Add User.Position field to store & model.

* GOFMT

* Add Position to user settings.

* Unit tests.

* Add position to profile popup.

* i18n

* Fix log message for invalid position.

* Add Position field attribute to LDAP config.

* Add Position field attribute to SAML config.

* Reword empty position message.

* Change Position Max Length to 35.

* Better invalid position error message.

* Add new fields to config.json.

* Ensure position is never longer than max when displayed.

* Hard limit of 64 chars with soft limit still 35

* Put field with other attributes.
---
 webapp/components/admin_console/saml_settings.jsx | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

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

diff --git a/webapp/components/admin_console/saml_settings.jsx b/webapp/components/admin_console/saml_settings.jsx
index c7cd73399..1391df0b6 100644
--- a/webapp/components/admin_console/saml_settings.jsx
+++ b/webapp/components/admin_console/saml_settings.jsx
@@ -41,6 +41,7 @@ export default class SamlSettings extends AdminSettings {
         config.SamlSettings.EmailAttribute = this.state.emailAttribute;
         config.SamlSettings.UsernameAttribute = this.state.usernameAttribute;
         config.SamlSettings.NicknameAttribute = this.state.nicknameAttribute;
+        config.SamlSettings.PositionAttribute = this.state.positionAttribute;
         config.SamlSettings.LocaleAttribute = this.state.localeAttribute;
         config.SamlSettings.LoginButtonText = this.state.loginButtonText;
 
@@ -65,6 +66,7 @@ export default class SamlSettings extends AdminSettings {
             emailAttribute: settings.EmailAttribute,
             usernameAttribute: settings.UsernameAttribute,
             nicknameAttribute: settings.NicknameAttribute,
+            positionAttribute: settings.PositionAttribute,
             localeAttribute: settings.LocaleAttribute,
             loginButtonText: settings.LoginButtonText
         };
@@ -508,6 +510,25 @@ export default class SamlSettings extends AdminSettings {
                     onChange={this.handleChange}
                     disabled={!this.state.enable}
                 />
+                <TextSetting
+                    id='positionAttribute'
+                    label={
+                        <FormattedMessage
+                            id='admin.saml.positionAttrTitle'
+                            defaultMessage='Position Attribute:'
+                        />
+                    }
+                    placeholder={Utils.localizeMessage('admin.saml.positionAttrEx', 'E.g.: "Role"')}
+                    helpText={
+                        <FormattedMessage
+                            id='admin.saml.positionAttrDesc'
+                            defaultMessage='(Optional) The attribute in the SAML Assertion that will be used to populate the position of users in Mattermost.'
+                        />
+                    }
+                    value={this.state.positionAttribute}
+                    onChange={this.handleChange}
+                    disabled={!this.state.enable}
+                />
                 <TextSetting
                     id='localeAttribute'
                     label={
-- 
cgit v1.2.3-1-g7c22

