1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-16 15:14:24 +00:00
gitea/services/auth/source
sillyguodong 890d10c7c8
Fix accidental overwriting of LDAP team memberships (#24050)
In the `for` loop, the value of `membershipsToAdd[org]` and
`membershipsToRemove[org]` is a slice that should be appended instead of
overwritten.
Due to the current overwrite, the LDAP group sync only matches the last
group at the moment.

## Example reproduction
- an LDAP user is both a member of
`cn=admin_staff,ou=people,dc=planetexpress,dc=com` and
`cn=ship_crew,ou=people,dc=planetexpress,dc=com`.
- configuration of `Map LDAP groups to Organization teams ` in
`Authentication Sources`:
```json
{
    "cn=admin_staff,ou=people,dc=planetexpress,dc=com":{
        "test_organization":[
            "admin_staff",
            "test_add"
        ]
    },
    "cn=ship_crew,ou=people,dc=planetexpress,dc=com":{
        "test_organization":[
            "ship_crew"
        ]
}
```
- start `Synchronize external user data` task in the `Dashboard`.
- the user was only added for the team `test_organization.ship_crew`
2023-04-11 19:54:26 -04:00
..
db Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
ldap Don't apply the group filter when listing LDAP group membership if it is empty (#23745) 2023-03-29 17:54:36 +08:00
oauth2 Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397) 2023-03-10 01:14:43 -05:00
pam Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
smtp Improve utils of slices (#22379) 2023-01-11 13:31:16 +08:00
sspi Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
source_group_sync.go Fix accidental overwriting of LDAP team memberships (#24050) 2023-04-11 19:54:26 -04:00