From b42bf80d0ef0f9559144575c12f4a37544a07d51 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 21 Dec 2022 14:57:06 +0100 Subject: [PATCH] graph: Rename noop backend to ErrEducationBackend --- services/graph/pkg/identity/err_school.go | 71 ++++++++++++++++++++++ services/graph/pkg/identity/noop_school.go | 71 ---------------------- services/graph/pkg/service/v0/service.go | 4 +- 3 files changed, 73 insertions(+), 73 deletions(-) create mode 100644 services/graph/pkg/identity/err_school.go delete mode 100644 services/graph/pkg/identity/noop_school.go diff --git a/services/graph/pkg/identity/err_school.go b/services/graph/pkg/identity/err_school.go new file mode 100644 index 000000000..103ae9ecd --- /dev/null +++ b/services/graph/pkg/identity/err_school.go @@ -0,0 +1,71 @@ +package identity + +import ( + "context" + "net/url" + + libregraph "github.com/owncloud/libre-graph-api-go" +) + +// ErrEducationBackend is a dummy EducationBackend, doing nothing +type ErrEducationBackend struct{} + +// CreateEducationSchool creates the supplied school in the identity backend. +func (i *ErrEducationBackend) CreateEducationSchool(ctx context.Context, school libregraph.EducationSchool) (*libregraph.EducationSchool, error) { + return nil, errNotImplemented +} + +// DeleteEducationSchool deletes a given school, identified by id +func (i *ErrEducationBackend) DeleteEducationSchool(ctx context.Context, id string) error { + return errNotImplemented +} + +// GetEducationSchool implements the EducationBackend interface for the ErrEducationBackend backend. +func (i *ErrEducationBackend) GetEducationSchool(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.EducationSchool, error) { + return nil, errNotImplemented +} + +// GetEducationSchools implements the EducationBackend interface for the ErrEducationBackend backend. +func (i *ErrEducationBackend) GetEducationSchools(ctx context.Context, queryParam url.Values) ([]*libregraph.EducationSchool, error) { + return nil, errNotImplemented +} + +// GetEducationSchoolMembers implements the EducationBackend interface for the ErrEducationBackend backend. +func (i *ErrEducationBackend) GetEducationSchoolMembers(ctx context.Context, id string) ([]*libregraph.EducationUser, error) { + return nil, errNotImplemented +} + +// AddMembersToEducationSchool adds new members (reference by a slice of IDs) to supplied school in the identity backend. +func (i *ErrEducationBackend) AddMembersToEducationSchool(ctx context.Context, schoolID string, memberID []string) error { + return errNotImplemented +} + +// RemoveMemberFromEducationSchool removes a single member (by ID) from a school +func (i *ErrEducationBackend) RemoveMemberFromEducationSchool(ctx context.Context, schoolID string, memberID string) error { + return errNotImplemented +} + +// CreateEducationUser creates a given education user in the identity backend. +func (i *ErrEducationBackend) CreateEducationUser(ctx context.Context, user libregraph.EducationUser) (*libregraph.EducationUser, error) { + return nil, errNotImplemented +} + +// DeleteEducationUser deletes a given educationuser, identified by username or id, from the backend +func (i *ErrEducationBackend) DeleteEducationUser(ctx context.Context, nameOrID string) error { + return errNotImplemented +} + +// UpdateEducationUser applies changes to given education user, identified by username or id +func (i *ErrEducationBackend) UpdateEducationUser(ctx context.Context, nameOrID string, user libregraph.EducationUser) (*libregraph.EducationUser, error) { + return nil, errNotImplemented +} + +// GetEducationUser implements the EducationBackend interface for the ErrEducationBackend backend. +func (i *ErrEducationBackend) GetEducationUser(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.EducationUser, error) { + return nil, errNotImplemented +} + +// GetEducationUsers implements the EducationBackend interface for the ErrEducationBackend backend. +func (i *ErrEducationBackend) GetEducationUsers(ctx context.Context, queryParam url.Values) ([]*libregraph.EducationUser, error) { + return nil, errNotImplemented +} diff --git a/services/graph/pkg/identity/noop_school.go b/services/graph/pkg/identity/noop_school.go deleted file mode 100644 index 39668e250..000000000 --- a/services/graph/pkg/identity/noop_school.go +++ /dev/null @@ -1,71 +0,0 @@ -package identity - -import ( - "context" - "net/url" - - libregraph "github.com/owncloud/libre-graph-api-go" -) - -// NOOP is a dummy EducationBackend, doing nothing -type NOOP struct{} - -// CreateEducationSchool creates the supplied school in the identity backend. -func (i *NOOP) CreateEducationSchool(ctx context.Context, school libregraph.EducationSchool) (*libregraph.EducationSchool, error) { - return nil, errNotImplemented -} - -// DeleteEducationSchool deletes a given school, identified by id -func (i *NOOP) DeleteEducationSchool(ctx context.Context, id string) error { - return errNotImplemented -} - -// GetEducationSchool implements the EducationBackend interface for the NOOP backend. -func (i *NOOP) GetEducationSchool(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.EducationSchool, error) { - return nil, errNotImplemented -} - -// GetEducationSchools implements the EducationBackend interface for the NOOP backend. -func (i *NOOP) GetEducationSchools(ctx context.Context, queryParam url.Values) ([]*libregraph.EducationSchool, error) { - return nil, errNotImplemented -} - -// GetEducationSchoolMembers implements the EducationBackend interface for the NOOP backend. -func (i *NOOP) GetEducationSchoolMembers(ctx context.Context, id string) ([]*libregraph.EducationUser, error) { - return nil, errNotImplemented -} - -// AddMembersToEducationSchool adds new members (reference by a slice of IDs) to supplied school in the identity backend. -func (i *NOOP) AddMembersToEducationSchool(ctx context.Context, schoolID string, memberID []string) error { - return errNotImplemented -} - -// RemoveMemberFromEducationSchool removes a single member (by ID) from a school -func (i *NOOP) RemoveMemberFromEducationSchool(ctx context.Context, schoolID string, memberID string) error { - return errNotImplemented -} - -// CreateEducationUser creates a given education user in the identity backend. -func (i *NOOP) CreateEducationUser(ctx context.Context, user libregraph.EducationUser) (*libregraph.EducationUser, error) { - return nil, errNotImplemented -} - -// DeleteEducationUser deletes a given educationuser, identified by username or id, from the backend -func (i *NOOP) DeleteEducationUser(ctx context.Context, nameOrID string) error { - return errNotImplemented -} - -// UpdateEducationUser applies changes to given education user, identified by username or id -func (i *NOOP) UpdateEducationUser(ctx context.Context, nameOrID string, user libregraph.EducationUser) (*libregraph.EducationUser, error) { - return nil, errNotImplemented -} - -// GetEducationUser implements the EducationBackend interface for the NOOP backend. -func (i *NOOP) GetEducationUser(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.EducationUser, error) { - return nil, errNotImplemented -} - -// GetEducationUsers implements the EducationBackend interface for the NOOP backend. -func (i *NOOP) GetEducationUsers(ctx context.Context, queryParam url.Values) ([]*libregraph.EducationUser, error) { - return nil, errNotImplemented -} diff --git a/services/graph/pkg/service/v0/service.go b/services/graph/pkg/service/v0/service.go index 16b37e53d..08c68ab90 100644 --- a/services/graph/pkg/service/v0/service.go +++ b/services/graph/pkg/service/v0/service.go @@ -156,8 +156,8 @@ func NewService(opts ...Option) Service { if options.Config.Identity.LDAP.EducationResourcesEnabled { svc.identityEducationBackend = lb } else { - noop := &identity.NOOP{} - svc.identityEducationBackend = noop + errEduBackend := &identity.ErrEducationBackend{} + svc.identityEducationBackend = errEduBackend } } default: