mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-04 18:14:53 -05:00
Update GetEducationSchoolUsers, AddUsersToEducationSchool, RemoveUserFromEducationSchool with schoolNumber.
This commit is contained in:
committed by
Ralf Haferkamp
parent
e0c6aa5c34
commit
80b8ce42f6
@@ -211,7 +211,7 @@ func (i *LDAP) GetEducationSchoolUsers(ctx context.Context, id string) ([]*libre
|
||||
logger := i.logger.SubloggerWithRequestID(ctx)
|
||||
logger.Debug().Str("backend", "ldap").Msg("GetEducationSchoolUsers")
|
||||
|
||||
schoolEntry, err := i.getSchoolByID(id)
|
||||
schoolEntry, err := i.getSchoolByNumberOrID(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -261,7 +261,7 @@ func (i *LDAP) AddUsersToEducationSchool(ctx context.Context, schoolID string, m
|
||||
logger := i.logger.SubloggerWithRequestID(ctx)
|
||||
logger.Debug().Str("backend", "ldap").Msg("AddUsersToEducationSchool")
|
||||
|
||||
schoolEntry, err := i.getSchoolByID(schoolID)
|
||||
schoolEntry, err := i.getSchoolByNumberOrID(schoolID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -306,7 +306,7 @@ func (i *LDAP) RemoveUserFromEducationSchool(ctx context.Context, schoolID strin
|
||||
logger := i.logger.SubloggerWithRequestID(ctx)
|
||||
logger.Debug().Str("backend", "ldap").Msg("RemoveUserFromEducationSchool")
|
||||
|
||||
schoolEntry, err := i.getSchoolByID(schoolID)
|
||||
schoolEntry, err := i.getSchoolByNumberOrID(schoolID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -347,12 +347,6 @@ func (i *LDAP) getSchoolByDN(dn string) (*ldap.Entry, error) {
|
||||
return i.getEntryByDN(dn, attrs, filter)
|
||||
}
|
||||
|
||||
func (i *LDAP) getSchoolByID(id string) (*ldap.Entry, error) {
|
||||
id = ldap.EscapeFilter(id)
|
||||
filter := fmt.Sprintf("(%s=%s)", i.educationConfig.schoolAttributeMap.id, id)
|
||||
return i.getSchoolByFilter(filter)
|
||||
}
|
||||
|
||||
func (i *LDAP) getSchoolByNumberOrID(numberOrId string) (*ldap.Entry, error) {
|
||||
numberOrId = ldap.EscapeFilter(numberOrId)
|
||||
filter := fmt.Sprintf(
|
||||
|
||||
@@ -234,7 +234,7 @@ var schoolByIDSearch1 *ldap.SearchRequest = &ldap.SearchRequest{
|
||||
BaseDN: "",
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: "(&(objectClass=ocEducationSchool)(owncloudUUID=abcd-defg))",
|
||||
Filter: "(&(objectClass=ocEducationSchool)(|(owncloudUUID=abcd-defg)(ocEducationSchoolNumber=abcd-defg)))",
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user