initial schools API

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2022-12-21 15:38:14 +01:00
committed by Ralf Haferkamp
parent 26e494ec8b
commit 9844f5f8ce
14 changed files with 1365 additions and 46 deletions
+18
View File
@@ -8,6 +8,7 @@ import (
libregraph "github.com/owncloud/libre-graph-api-go"
)
// Backend defines the Interface for an IdentityBackend implementation
type Backend interface {
// CreateUser creates a given user in the identity backend.
CreateUser(ctx context.Context, user libregraph.User) (*libregraph.User, error)
@@ -31,6 +32,23 @@ type Backend interface {
RemoveMemberFromGroup(ctx context.Context, groupID string, memberID string) error
}
// EducationBackend defines the Interface for an EducationBackend implementation
type EducationBackend interface {
// CreateSchool creates the supplied school in the identity backend.
CreateSchool(ctx context.Context, group libregraph.EducationSchool) (*libregraph.EducationSchool, error)
// DeleteSchool deletes a given school, identified by id
DeleteSchool(ctx context.Context, id string) error
// GetSchool reads a given school by id
GetSchool(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.EducationSchool, error)
// GetSchools lists all schools
GetSchools(ctx context.Context, queryParam url.Values) ([]*libregraph.EducationSchool, error)
GetSchoolMembers(ctx context.Context, id string) ([]*libregraph.User, error)
// AddMembersToSchool adds new members (reference by a slice of IDs) to supplied school in the identity backend.
AddMembersToSchool(ctx context.Context, schoolID string, memberID []string) error
// RemoveMemberFromSchool removes a single member (by ID) from a school
RemoveMemberFromSchool(ctx context.Context, schoolID string, memberID string) error
}
func CreateUserModelFromCS3(u *cs3.User) *libregraph.User {
if u.Id == nil {
u.Id = &cs3.UserId{}