summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lu <david.lu@hotmail.com>2016-06-30 08:43:46 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-06-30 08:43:46 -0400
commit1c8962cf9981edf14933264bc060168723e0bde1 (patch)
treeae7b4de755e54f870d8ab4293d419c47466b9437
parent65e18ad1f553d91c28b444afaced08f462f9d374 (diff)
downloadchat-1c8962cf9981edf14933264bc060168723e0bde1.tar.gz
chat-1c8962cf9981edf14933264bc060168723e0bde1.tar.bz2
chat-1c8962cf9981edf14933264bc060168723e0bde1.zip
enabled team creation for sysadmins (#3433)
-rw-r--r--api/team.go2
-rw-r--r--model/user.go4
-rw-r--r--webapp/components/admin_console/users_and_teams_settings.jsx2
-rw-r--r--webapp/components/select_team/select_team.jsx13
-rw-r--r--webapp/i18n/en.json3
5 files changed, 19 insertions, 5 deletions
diff --git a/api/team.go b/api/team.go
index cb942bb35..9b23a63af 100644
--- a/api/team.go
+++ b/api/team.go
@@ -295,7 +295,7 @@ func isTeamCreationAllowed(c *Context, email string) bool {
email = strings.ToLower(email)
- if !utils.Cfg.TeamSettings.EnableTeamCreation {
+ if !c.IsSystemAdmin() && !utils.Cfg.TeamSettings.EnableTeamCreation {
c.Err = model.NewLocAppError("isTeamCreationAllowed", "api.team.is_team_creation_allowed.disabled.app_error", nil, "")
return false
}
diff --git a/model/user.go b/model/user.go
index 6866dbbb8..1047cc429 100644
--- a/model/user.go
+++ b/model/user.go
@@ -362,13 +362,13 @@ func isValidRole(role string) bool {
return false
}
-// Make sure you acually want to use this function. In context.go there are functions to check permssions
+// Make sure you acually want to use this function. In context.go there are functions to check permissions
// This function should not be used to check permissions.
func (u *User) IsInRole(inRole string) bool {
return IsInRole(u.Roles, inRole)
}
-// Make sure you acually want to use this function. In context.go there are functions to check permssions
+// Make sure you acually want to use this function. In context.go there are functions to check permissions
// This function should not be used to check permissions.
func IsInRole(userRoles string, inRole string) bool {
roles := strings.Split(userRoles, " ")
diff --git a/webapp/components/admin_console/users_and_teams_settings.jsx b/webapp/components/admin_console/users_and_teams_settings.jsx
index 15301854f..b2f8afe1b 100644
--- a/webapp/components/admin_console/users_and_teams_settings.jsx
+++ b/webapp/components/admin_console/users_and_teams_settings.jsx
@@ -86,7 +86,7 @@ export default class UsersAndTeamsSettings extends AdminSettings {
helpText={
<FormattedMessage
id='admin.team.teamCreationDescription'
- defaultMessage='When false, the ability to create teams is disabled. The create team button displays error when pressed.'
+ defaultMessage='When false, only System Administrators can create teams.'
/>
}
value={this.state.enableTeamCreation}
diff --git a/webapp/components/select_team/select_team.jsx b/webapp/components/select_team/select_team.jsx
index 3b1cf829a..cc53b6b8f 100644
--- a/webapp/components/select_team/select_team.jsx
+++ b/webapp/components/select_team/select_team.jsx
@@ -152,6 +152,16 @@ export default class SelectTeam extends React.Component {
var isSystemAdmin = Utils.isSystemAdmin(UserStore.getCurrentUser().roles);
+ let teamHelp = null;
+ if (isSystemAdmin && (global.window.mm_config.EnableTeamCreation === 'false')) {
+ teamHelp = (
+ <FormattedMessage
+ id='login.createTeamAdminOnly'
+ defaultMessage='This option is only available for System Administrators, and does not show up for other users.'
+ />
+ );
+ }
+
let teamSignUp;
if (isSystemAdmin || (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp())) {
teamSignUp = (
@@ -165,6 +175,9 @@ export default class SelectTeam extends React.Component {
defaultMessage='Create a new team'
/>
</Link>
+ <div>
+ {teamHelp}
+ </div>
</div>
);
}
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 1fb274223..3e052577b 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -574,7 +574,7 @@
"admin.team.siteNameDescription": "Name of service shown in login screens and UI.",
"admin.team.siteNameExample": "Ex \"Mattermost\"",
"admin.team.siteNameTitle": "Site Name:",
- "admin.team.teamCreationDescription": "When false, the ability to create teams is disabled. The create team button displays error when pressed.",
+ "admin.team.teamCreationDescription": "When false, only System Administrators can create teams.",
"admin.team.teamCreationTitle": "Enable Team Creation: ",
"admin.team.upload": "Upload",
"admin.team.uploadDesc": "Customize your user experience by adding a custom image to your login screen. See examples at <a href='http://docs.mattermost.com/administration/config-settings.html#custom-branding' target='_blank'>docs.mattermost.com/administration/config-settings.html#custom-branding</a>.",
@@ -1028,6 +1028,7 @@
"login.changed": " Sign-in method changed successfully",
"login.create": "Create one now",
"login.createTeam": "Create a new team",
+ "login.createTeamAdminOnly": "This option is only available for System Administrators, and does not show up for other users.",
"login.email": "Email",
"login.find": "Find your other teams",
"login.forgot": "I forgot my password",