refactor: align module naming with ai-agent
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package agentdesk
|
package aiagent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@@ -19,10 +19,10 @@ type Options struct {
|
|||||||
// authorization must already have been completed by the host system.
|
// authorization must already have been completed by the host system.
|
||||||
func New(options Options) (http.Handler, error) {
|
func New(options Options) (http.Handler, error) {
|
||||||
if options.QuerySubjects == nil {
|
if options.QuerySubjects == nil {
|
||||||
return nil, errors.New("agent-desk: QuerySubjects is required")
|
return nil, errors.New("ai-agent: QuerySubjects is required")
|
||||||
}
|
}
|
||||||
if options.Authorize == nil {
|
if options.Authorize == nil {
|
||||||
return nil, errors.New("agent-desk: Authorize is required")
|
return nil, errors.New("ai-agent: Authorize is required")
|
||||||
}
|
}
|
||||||
if options.ConfigPath == "" {
|
if options.ConfigPath == "" {
|
||||||
options.ConfigPath = "config/config.yaml"
|
options.ConfigPath = "config/config.yaml"
|
||||||
@@ -37,7 +37,7 @@ func (s *subjectService) Authorize(ctx context.Context, operation string) error
|
|||||||
fn := s.authorize
|
fn := s.authorize
|
||||||
s.mu.RUnlock()
|
s.mu.RUnlock()
|
||||||
if fn == nil {
|
if fn == nil {
|
||||||
return errors.New("agent-desk: Authorize is not initialized")
|
return errors.New("ai-agent: Authorize is not initialized")
|
||||||
}
|
}
|
||||||
return fn(ctx, operation)
|
return fn(ctx, operation)
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ func (s *subjectService) Query(ctx context.Context, query identity.Query) ([]ide
|
|||||||
fn := s.query
|
fn := s.query
|
||||||
s.mu.RUnlock()
|
s.mu.RUnlock()
|
||||||
if fn == nil {
|
if fn == nil {
|
||||||
return nil, errors.New("agent-desk: QuerySubjects is not initialized")
|
return nil, errors.New("ai-agent: QuerySubjects is not initialized")
|
||||||
}
|
}
|
||||||
return fn(ctx, query)
|
return fn(ctx, query)
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ func (s *subjectService) Current(ctx context.Context) (*identity.Subject, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(items) == 0 {
|
if len(items) == 0 {
|
||||||
return nil, errors.New("agent-desk: current subject not found")
|
return nil, errors.New("ai-agent: current subject not found")
|
||||||
}
|
}
|
||||||
return &items[0], nil
|
return &items[0], nil
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ func (s *subjectService) CurrentExternal(ctx context.Context) (*openidentity.Ext
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if subject.Category != identity.CategoryUser || !subject.Enabled {
|
if subject.Category != identity.CategoryUser || !subject.Enabled {
|
||||||
return nil, errors.New("agent-desk: current subject is not a customer identity")
|
return nil, errors.New("ai-agent: current subject is not a customer identity")
|
||||||
}
|
}
|
||||||
return &openidentity.ExternalUser{
|
return &openidentity.ExternalUser{
|
||||||
ExternalSource: enums.ExternalSourceUser,
|
ExternalSource: enums.ExternalSourceUser,
|
||||||
|
|||||||
Reference in New Issue
Block a user