MM-17477: Truncates group display name upon linking. (#12751)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4225977966
Коммит
c742d18828
12
api4/ldap.go
12
api4/ldap.go
@@ -155,13 +155,21 @@ func linkLdapGroup(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
var status int
|
var status int
|
||||||
var newOrUpdatedGroup *model.Group
|
var newOrUpdatedGroup *model.Group
|
||||||
|
|
||||||
|
// Truncate display name if necessary
|
||||||
|
var displayName string
|
||||||
|
if len(ldapGroup.DisplayName) > model.GroupDisplayNameMaxLength {
|
||||||
|
displayName = ldapGroup.DisplayName[:model.GroupDisplayNameMaxLength]
|
||||||
|
} else {
|
||||||
|
displayName = ldapGroup.DisplayName
|
||||||
|
}
|
||||||
|
|
||||||
// Group has been previously linked
|
// Group has been previously linked
|
||||||
if group != nil {
|
if group != nil {
|
||||||
if group.DeleteAt == 0 {
|
if group.DeleteAt == 0 {
|
||||||
newOrUpdatedGroup = group
|
newOrUpdatedGroup = group
|
||||||
} else {
|
} else {
|
||||||
group.DeleteAt = 0
|
group.DeleteAt = 0
|
||||||
group.DisplayName = ldapGroup.DisplayName
|
group.DisplayName = displayName
|
||||||
group.RemoteId = ldapGroup.RemoteId
|
group.RemoteId = ldapGroup.RemoteId
|
||||||
newOrUpdatedGroup, err = c.App.UpdateGroup(group)
|
newOrUpdatedGroup, err = c.App.UpdateGroup(group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -178,7 +186,7 @@ func linkLdapGroup(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
// the LDAP group name with an appended duplicate-breaker.
|
// the LDAP group name with an appended duplicate-breaker.
|
||||||
newGroup := &model.Group{
|
newGroup := &model.Group{
|
||||||
Name: model.NewId(),
|
Name: model.NewId(),
|
||||||
DisplayName: ldapGroup.DisplayName,
|
DisplayName: displayName,
|
||||||
RemoteId: ldapGroup.RemoteId,
|
RemoteId: ldapGroup.RemoteId,
|
||||||
Source: model.GroupSourceLdap,
|
Source: model.GroupSourceLdap,
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user