initial skel for external tenant id

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2026-02-10 10:45:09 +01:00
committed by Christian Richter
parent 13ae67b02c
commit 5877bfa8a2
4 changed files with 8 additions and 4 deletions
@@ -42,4 +42,4 @@ olcObjectClasses: ( openCloudOid:1.2.5 NAME 'openCloudEducationSchool'
DESC 'OpenCloud education school objectclass' DESC 'OpenCloud education school objectclass'
SUP openCloudObject SUP openCloudObject
AUXILIARY AUXILIARY
MAY ( openCloudEducationSchoolNumber $ openCloudEducationSchoolTerminationTimestamp ) ) MAY ( openCloudEducationSchoolNumber $ openCloudEducationSchoolTerminationTimestamp $ openCloudEducationExternalId) )
+1
View File
@@ -80,6 +80,7 @@ type LDAP struct {
type userAttributeMap struct { type userAttributeMap struct {
displayName string displayName string
id string id string
externalId string
mail string mail string
userName string userName string
givenName string givenName string
@@ -7,8 +7,8 @@ import (
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"github.com/libregraph/idm/pkg/ldapdn" "github.com/libregraph/idm/pkg/ldapdn"
"github.com/opencloud-eu/opencloud/services/graph/pkg/errorcode"
libregraph "github.com/opencloud-eu/libre-graph-api-go" libregraph "github.com/opencloud-eu/libre-graph-api-go"
"github.com/opencloud-eu/opencloud/services/graph/pkg/errorcode"
) )
type educationClassAttributeMap struct { type educationClassAttributeMap struct {
@@ -349,6 +349,7 @@ func (i *LDAP) getEducationClassByID(nameOrID string, requestMembers bool) (*lda
return i.getEducationObjectByNameOrID( return i.getEducationObjectByNameOrID(
nameOrID, nameOrID,
i.userAttributeMap.id, i.userAttributeMap.id,
i.userAttributeMap.externalId,
i.educationConfig.classAttributeMap.externalID, i.educationConfig.classAttributeMap.externalID,
i.groupFilter, i.groupFilter,
i.educationConfig.classObjectClass, i.educationConfig.classObjectClass,
@@ -318,6 +318,7 @@ func (i *LDAP) getEducationUserAttrTypes() []string {
return []string{ return []string{
i.userAttributeMap.displayName, i.userAttributeMap.displayName,
i.userAttributeMap.id, i.userAttributeMap.id,
i.userAttributeMap.externalId,
i.userAttributeMap.mail, i.userAttributeMap.mail,
i.userAttributeMap.userName, i.userAttributeMap.userName,
i.userAttributeMap.surname, i.userAttributeMap.surname,
@@ -345,6 +346,7 @@ func (i *LDAP) getEducationUserByNameOrID(nameOrID string) (*ldap.Entry, error)
nameOrID, nameOrID,
i.userAttributeMap.userName, i.userAttributeMap.userName,
i.userAttributeMap.id, i.userAttributeMap.id,
i.userAttributeMap.externalId,
i.userFilter, i.userFilter,
i.educationConfig.userObjectClass, i.educationConfig.userObjectClass,
i.userBaseDN, i.userBaseDN,
@@ -352,9 +354,9 @@ func (i *LDAP) getEducationUserByNameOrID(nameOrID string) (*ldap.Entry, error)
) )
} }
func (i *LDAP) getEducationObjectByNameOrID(nameOrID, nameAttribute, idAttribute, objectFilter, objectClass, baseDN string, attributes []string) (*ldap.Entry, error) { func (i *LDAP) getEducationObjectByNameOrID(nameOrID, nameAttribute, idAttribute, externalIdAttribute, objectFilter, objectClass, baseDN string, attributes []string) (*ldap.Entry, error) {
nameOrID = ldap.EscapeFilter(nameOrID) nameOrID = ldap.EscapeFilter(nameOrID)
filter := fmt.Sprintf("(|(%s=%s)(%s=%s))", nameAttribute, nameOrID, idAttribute, nameOrID) filter := fmt.Sprintf("(|(%s=%s)(%s=%s)(%s=%s)", nameAttribute, nameOrID, idAttribute, nameOrID, externalIdAttribute, nameOrID)
return i.getEducationObjectByFilter(filter, baseDN, objectFilter, objectClass, attributes) return i.getEducationObjectByFilter(filter, baseDN, objectFilter, objectClass, attributes)
} }