Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Этот коммит содержится в:
@@ -28,7 +28,7 @@ func (me *InvitePeopleProvider) GetTrigger() string {
|
||||
|
||||
func (me *InvitePeopleProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
|
||||
autoComplete := true
|
||||
if !a.Config().EmailSettings.SendEmailNotifications || !a.Config().TeamSettings.EnableUserCreation {
|
||||
if !a.Config().EmailSettings.SendEmailNotifications || !*a.Config().TeamSettings.EnableUserCreation {
|
||||
autoComplete = false
|
||||
}
|
||||
return &model.Command{
|
||||
@@ -45,7 +45,7 @@ func (me *InvitePeopleProvider) DoCommand(a *App, args *model.CommandArgs, messa
|
||||
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.email_off")}
|
||||
}
|
||||
|
||||
if !a.Config().TeamSettings.EnableUserCreation {
|
||||
if !*a.Config().TeamSettings.EnableUserCreation {
|
||||
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.invite_off")}
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ func (a *App) trackConfig() {
|
||||
})
|
||||
|
||||
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||
"enable_user_creation": cfg.TeamSettings.EnableUserCreation,
|
||||
"enable_user_creation": *cfg.TeamSettings.EnableUserCreation,
|
||||
"enable_team_creation": *cfg.TeamSettings.EnableTeamCreation,
|
||||
"restrict_team_invite": *cfg.TeamSettings.RestrictTeamInvite,
|
||||
"restrict_public_channel_creation": *cfg.TeamSettings.RestrictPublicChannelCreation,
|
||||
|
||||
@@ -67,9 +67,11 @@ func (a *App) GetUserForLogin(id, loginId string) (*model.User, *model.AppError)
|
||||
return result.Data.(*model.User), nil
|
||||
}
|
||||
|
||||
// Try to get the user with LDAP
|
||||
if user, err := a.Ldap.GetUser(loginId); err == nil {
|
||||
return user, nil
|
||||
// Try to get the user with LDAP if enabled
|
||||
if *a.Config().LdapSettings.Enable && a.Ldap != nil {
|
||||
if user, err := a.Ldap.GetUser(loginId); err == nil {
|
||||
return user, nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, model.NewAppError("GetUserForLogin", "store.sql_user.get_for_login.app_error", nil, "", http.StatusBadRequest)
|
||||
|
||||
@@ -87,7 +87,7 @@ func (a *App) GetStatusesByIds(userIds []string) (map[string]interface{}, *model
|
||||
statuses := result.Data.([]*model.Status)
|
||||
|
||||
for _, s := range statuses {
|
||||
a.AddStatusCache(s)
|
||||
a.AddStatusCacheSkipClusterSend(s)
|
||||
statusMap[s.UserId] = s.Status
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func (a *App) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.Ap
|
||||
statuses := result.Data.([]*model.Status)
|
||||
|
||||
for _, s := range statuses {
|
||||
a.AddStatusCache(s)
|
||||
a.AddStatusCacheSkipClusterSend(s)
|
||||
}
|
||||
|
||||
statusMap = append(statusMap, statuses...)
|
||||
|
||||
@@ -162,7 +162,7 @@ func (a *App) CreateUserFromSignup(user *model.User) (*model.User, *model.AppErr
|
||||
}
|
||||
|
||||
func (a *App) IsUserSignUpAllowed() *model.AppError {
|
||||
if !a.Config().EmailSettings.EnableSignUpWithEmail || !a.Config().TeamSettings.EnableUserCreation {
|
||||
if !a.Config().EmailSettings.EnableSignUpWithEmail || !*a.Config().TeamSettings.EnableUserCreation {
|
||||
err := model.NewAppError("IsUserSignUpAllowed", "api.user.create_user.signup_email_disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
return err
|
||||
}
|
||||
@@ -250,7 +250,7 @@ func (a *App) createUser(user *model.User) (*model.User, *model.AppError) {
|
||||
}
|
||||
|
||||
func (a *App) CreateOAuthUser(service string, userData io.Reader, teamId string) (*model.User, *model.AppError) {
|
||||
if !a.Config().TeamSettings.EnableUserCreation {
|
||||
if !*a.Config().TeamSettings.EnableUserCreation {
|
||||
return nil, model.NewAppError("CreateOAuthUser", "api.user.create_user.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ func TestCreateOAuthUser(t *testing.T) {
|
||||
|
||||
th.App.PermanentDeleteUser(user)
|
||||
|
||||
th.App.Config().TeamSettings.EnableUserCreation = false
|
||||
*th.App.Config().TeamSettings.EnableUserCreation = false
|
||||
|
||||
_, err = th.App.CreateOAuthUser(model.USER_AUTH_SERVICE_GITLAB, strings.NewReader(json), th.BasicTeam.Id)
|
||||
if err == nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user