PLT-350 allow ability to disable restricted team names

Этот коммит содержится в:
=Corey Hulen
2015-10-20 17:30:24 -07:00
родитель 7ea8268ae8
Коммит b9ce4a644d
8 изменённых файлов: 56 добавлений и 16 удалений

Просмотреть файл

@@ -122,6 +122,7 @@ type TeamSettings struct {
EnableTeamCreation bool
EnableUserCreation bool
RestrictCreationToDomains string
RestrictTeamNames *bool
}
type Config struct {
@@ -169,6 +170,11 @@ func (o *Config) SetDefaults() {
o.ServiceSettings.EnableSecurityFixAlert = new(bool)
*o.ServiceSettings.EnableSecurityFixAlert = true
}
if o.TeamSettings.RestrictTeamNames == nil {
o.TeamSettings.RestrictTeamNames = new(bool)
*o.TeamSettings.RestrictTeamNames = true
}
}
func (o *Config) IsValid() *AppError {

Просмотреть файл

@@ -97,7 +97,7 @@ func (o *Team) Etag() string {
return Etag(o.Id, o.UpdateAt)
}
func (o *Team) IsValid() *AppError {
func (o *Team) IsValid(restrictTeamNames bool) *AppError {
if len(o.Id) != 26 {
return NewAppError("Team.IsValid", "Invalid Id", "")
@@ -127,7 +127,7 @@ func (o *Team) IsValid() *AppError {
return NewAppError("Team.IsValid", "Invalid URL Identifier", "id="+o.Id)
}
if IsReservedTeamName(o.Name) {
if restrictTeamNames && IsReservedTeamName(o.Name) {
return NewAppError("Team.IsValid", "This URL is unavailable. Please try another.", "id="+o.Id)
}