Add SCIM management

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-01-04 19:03:00 +01:00
parent b6799cbb01
commit cfc514c8e0
405 changed files with 4888 additions and 88927 deletions

View File

@@ -272,3 +272,59 @@ func (s *Service) GetPersonalAPIKey(ctx context.Context, personalAPIKeyID gid.GI
return personalAPIKey, nil
}
func (s *Service) GetSCIMConfiguration(ctx context.Context, scimConfigurationID gid.GID) (*coredata.SCIMConfiguration, error) {
var (
scope = coredata.NewScopeFromObjectID(scimConfigurationID)
scimConfiguration = &coredata.SCIMConfiguration{}
)
err := s.pg.WithConn(
ctx,
func(conn pg.Conn) error {
err := scimConfiguration.LoadByID(ctx, conn, scope, scimConfigurationID)
if err != nil {
if err == coredata.ErrResourceNotFound {
return scim.NewSCIMConfigurationNotFoundError(scimConfigurationID)
}
return fmt.Errorf("cannot load SCIM configuration: %w", err)
}
return nil
},
)
if err != nil {
return nil, err
}
return scimConfiguration, nil
}
func (s *Service) GetSCIMEvent(ctx context.Context, scimEventID gid.GID) (*coredata.SCIMEvent, error) {
var (
scope = coredata.NewScopeFromObjectID(scimEventID)
scimEvent = &coredata.SCIMEvent{}
)
err := s.pg.WithConn(
ctx,
func(conn pg.Conn) error {
err := scimEvent.LoadByID(ctx, conn, scope, scimEventID)
if err != nil {
if err == coredata.ErrResourceNotFound {
return fmt.Errorf("SCIM event not found: %s", scimEventID)
}
return fmt.Errorf("cannot load SCIM event: %w", err)
}
return nil
},
)
if err != nil {
return nil, err
}
return scimEvent, nil
}