Requiring team admin to import and fixing a few style issues
Этот коммит содержится в:
@@ -24,7 +24,7 @@ type SlackChannel struct {
|
|||||||
|
|
||||||
type SlackUser struct {
|
type SlackUser struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
UserName string `json:"name"`
|
Username string `json:"name"`
|
||||||
Profile map[string]string `json:"profile"`
|
Profile map[string]string `json:"profile"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,6 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map
|
|||||||
log.WriteString("\n Users Created\n")
|
log.WriteString("\n Users Created\n")
|
||||||
log.WriteString("===============\n\n")
|
log.WriteString("===============\n\n")
|
||||||
|
|
||||||
// Add users
|
|
||||||
addedUsers := make(map[string]*model.User)
|
addedUsers := make(map[string]*model.User)
|
||||||
for _, sUser := range slackusers {
|
for _, sUser := range slackusers {
|
||||||
firstName := ""
|
firstName := ""
|
||||||
@@ -101,7 +100,7 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map
|
|||||||
|
|
||||||
newUser := model.User{
|
newUser := model.User{
|
||||||
TeamId: teamId,
|
TeamId: teamId,
|
||||||
Username: sUser.UserName,
|
Username: sUser.Username,
|
||||||
FirstName: firstName,
|
FirstName: firstName,
|
||||||
LastName: lastName,
|
LastName: lastName,
|
||||||
Email: sUser.Profile["email"],
|
Email: sUser.Profile["email"],
|
||||||
@@ -112,7 +111,7 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map
|
|||||||
addedUsers[sUser.Id] = mUser
|
addedUsers[sUser.Id] = mUser
|
||||||
log.WriteString("Email, Password: " + newUser.Email + ", " + password + "\n")
|
log.WriteString("Email, Password: " + newUser.Email + ", " + password + "\n")
|
||||||
} else {
|
} else {
|
||||||
log.WriteString("Unable to import user: " + sUser.UserName)
|
log.WriteString("Unable to import user: " + sUser.Username)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +166,6 @@ func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[str
|
|||||||
log.WriteString("\n Channels Added \n")
|
log.WriteString("\n Channels Added \n")
|
||||||
log.WriteString("=================\n\n")
|
log.WriteString("=================\n\n")
|
||||||
|
|
||||||
// Add channels
|
|
||||||
addedChannels := make(map[string]*model.Channel)
|
addedChannels := make(map[string]*model.Channel)
|
||||||
for _, sChannel := range slackchannels {
|
for _, sChannel := range slackchannels {
|
||||||
newChannel := model.Channel{
|
newChannel := model.Channel{
|
||||||
|
|||||||
@@ -494,8 +494,7 @@ func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func importTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
func importTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
if !c.HasPermissionsToTeam(c.Session.TeamId, "import") || !c.IsTeamAdmin(c.Session.UserId) {
|
||||||
if !c.HasPermissionsToTeam(c.Session.TeamId, "import") {
|
|
||||||
c.Err = model.NewAppError("importTeam", "Only a team admin can import data.", "userId="+c.Session.UserId)
|
c.Err = model.NewAppError("importTeam", "Only a team admin can import data.", "userId="+c.Session.UserId)
|
||||||
c.Err.StatusCode = http.StatusForbidden
|
c.Err.StatusCode = http.StatusForbidden
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
var BrowserStore = require('../stores/browser_store.jsx');
|
var BrowserStore = require('../stores/browser_store.jsx');
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user