Documentation
¶
Index ¶
- Variables
- func IsImpersonating(r *http.Request) bool
- func SetAgentsLayout(l agentconfig.Layout)
- type AccessDetail
- type AccessItem
- type AccessItemGroup
- type DataTableLister
- type Handler
- func (h *Handler) Register(mux *http.ServeMux, sessionMidd *login.Middleware)
- func (h *Handler) SetDataTables(l DataTableLister)
- func (h *Handler) SetOnUserApproved(fn func(ctx context.Context, userID string))
- func (h *Handler) SetProjectWriter(w ProjectWriter)
- func (h *Handler) SetSchedules(l ScheduleLister, p ProjectNamer)
- func (h *Handler) SetWorkflowOwnerWriter(w WorkflowOwnerWriter)
- type JobListProvider
- type LoginStat
- type ProjectLister
- type ProjectNamer
- type ProjectWriter
- type ScheduleLister
- type SkillLister
- type SystemConfig
- type TagUsage
- type ToolPerm
- type WorkflowInfo
- type WorkflowLister
- type WorkflowOwnerWriter
Constants ¶
This section is empty.
Variables ¶
var ErrLastAdmin = errors.New("cannot demote the last admin")
ErrLastAdmin is returned when trying to demote the only remaining admin.
var ErrOwnerTagImmutable = errors.New("owner tags are managed automatically and cannot be modified")
var ErrSystemEntityImmutable = errors.New("entity is system-tagged and cannot be modified from the admin UI")
ErrSystemEntityImmutable is returned when an admin tries to mutate (disable/hide/retag) a tool/job/connector that carries any System tag. System-tagged entities are owned by code — see entity.Tag godoc.
var ErrSystemTagAssignment = errors.New("system tags cannot be assigned to users")
ErrSystemTagAssignment is returned when an admin tries to attach a tag flagged IsSystem to a user. System tags are code-owned and exist solely to gate built-in maintenance items behind a tag no end user can carry — see entity.Tag godoc.
var ErrSystemTagImmutable = errors.New("system tags are read-only and cannot be modified")
ErrSystemTagImmutable is returned when an admin tries to edit, delete, or otherwise mutate a Tag whose IsSystem flag is true. System tags are owned by code (seeded via tool/job DefaultTags) and changing them from the UI would desync the seed catalog from the DB.
var ErrTagNameTaken = errors.New("a tag with that name already exists")
ErrTagNameTaken is returned when creating or renaming a tag to an existing name.
var ErrUserNotApproved = errors.New("user must be approved before assigning tags")
ErrUserNotApproved is returned when trying to assign tags to an unapproved user.
var StaticFS embed.FS
Functions ¶
func IsImpersonating ¶ added in v1.0.0
IsImpersonating reports whether the current request runs inside a switch, so the UI can show a banner with a way back. Without that, an admin can forget they are someone else and misread everything they see.
func SetAgentsLayout ¶ added in v1.2.9
func SetAgentsLayout(l agentconfig.Layout)
SetAgentsLayout wires the session store for the analytics page.
Types ¶
type AccessDetail ¶ added in v1.2.9
type AccessDetail struct {
Path string `json:"path"`
Kind string `json:"kind"`
// KindOne is Kind in the singular, for the modal's sentence.
KindOne string `json:"kind_one"`
// Public: the item carries no filter tag, so every approved user reaches
// it and Users lists all of them.
Public bool `json:"public"`
Tags []string `json:"tags"`
// OwnerScoped: untagged here means owner-only, not everyone.
OwnerScoped bool `json:"owner_scoped"`
// TagsInert: the tags below are never read by this surface's visibility
// check, so they grant nobody anything.
TagsInert bool `json:"tags_inert"`
Users []adminUser `json:"users"`
}
AccessDetail answers "who reaches this one item, and how".
type AccessItem ¶ added in v1.2.9
type AccessItem struct {
Path string `json:"path"`
Kind string `json:"kind"`
Label string `json:"label"`
}
AccessItem is one thing a tag grants access to.
type AccessItemGroup ¶ added in v1.2.9
type AccessItemGroup struct {
Kind string `json:"kind"`
Items []AccessItem `json:"items"`
}
AccessItemGroup buckets a tag's granted items by surface.
type DataTableLister ¶ added in v0.30.1
type DataTableLister interface {
ListTables() []string
LoadSchema(slug string) (datatable.Schema, error)
}
DataTableLister lists data tables + their schema for the admin grant page. Satisfied directly by datatable.Service (wfMgr.DataTables).
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler( db *gorm.DB, tools []tool.Tool, configsSvc *configs.Service, ssoSvc *sso.Service, svc JobListProvider, connectorsSvc *connectors.Service, tokensSvc *accesstoken.Service, oauthSvc *oauth.Service, authSvc *login.Service, projects ProjectLister, workflows WorkflowLister, skillsDB SkillLister, sys SystemConfig, ) *Handler
func (*Handler) Register ¶
func (h *Handler) Register(mux *http.ServeMux, sessionMidd *login.Middleware)
func (*Handler) SetDataTables ¶ added in v0.30.1
func (h *Handler) SetDataTables(l DataTableLister)
SetDataTables wires the data-tables lister for the /admin/data-tables grant page. Optional — when unset the page returns 503. Kept as a post-construction setter so NewHandler's positional signature doesn't grow another param.
func (*Handler) SetOnUserApproved ¶ added in v1.0.0
SetOnUserApproved wires the post-approval notice hook. Called once at boot.
func (*Handler) SetProjectWriter ¶ added in v1.2.9
func (h *Handler) SetProjectWriter(w ProjectWriter)
SetProjectWriter wires the writer behind the projects Owner picker. Optional, like SetDataTables and SetSchedules: nil leaves the page rendering and the endpoint refusing, rather than panicking.
func (*Handler) SetSchedules ¶ added in v1.2.9
func (h *Handler) SetSchedules(l ScheduleLister, p ProjectNamer)
SetSchedules wires the schedules page post-construction, matching how the other optional dependencies are attached. Nil simply leaves the page reporting that scheduling is not configured on this instance.
func (*Handler) SetWorkflowOwnerWriter ¶ added in v1.2.9
func (h *Handler) SetWorkflowOwnerWriter(w WorkflowOwnerWriter)
SetWorkflowOwnerWriter wires the writer behind the workflows Owner picker.
type JobListProvider ¶
JobListProvider is the subset of manager.Service that the admin panel needs.
type LoginStat ¶ added in v1.2.9
LoginStat is what the sessions table can say about one person: when they last signed in, how many times, and whether a session of theirs is still valid right now. A login IS a row here, so no new bookkeeping is needed to answer "who still uses this".
type ProjectLister ¶ added in v0.17.0
type ProjectLister interface {
Projects() map[string]agentproject.Project
}
ProjectLister lists all projects from the in-memory registry.
type ProjectNamer ¶ added in v1.2.9
ProjectNamer resolves a project id to its display name, so the page can show "Ygsw Bot" instead of a uuid.
type ProjectWriter ¶ added in v1.2.9
type ProjectWriter interface {
UpdateProject(ctx context.Context, id string, meta agentproject.Meta) (agentproject.Project, error)
}
ProjectWriter persists a project's metadata. Satisfied by registry.Manager — kept as an interface so package admin keeps depending on the registry only through the shapes it actually uses.
type ScheduleLister ¶ added in v1.2.9
type ScheduleLister interface {
ListAll(ctx context.Context, limit int) ([]entity.ScheduledMessage, error)
Reschedule(ctx context.Context, id string, patch schedule.SchedulePatch) error
}
ScheduleLister is the slice of the schedule store this page needs, kept as an interface so package admin does not depend on the store's concrete type.
type SkillLister ¶ added in v0.17.0
SkillLister lists all skills from the DB.
type SystemConfig ¶ added in v0.23.3
type SystemConfig struct {
Coordinator *updater.Coordinator
// VersionCache is the background-refreshed version + update snapshot.
// The System page reads the wick-framework version, update status, and
// cached changelog from it instead of doing a live request on load.
VersionCache *updater.VersionCache
AppName string
// DataDir is wick's data directory — where a draining predecessor leaves
// the record of what it is still finishing.
DataDir string
// AppVersion is the version THIS process is running — compared against
// the binary on disk to spot a build that is installed but not yet
// swapped in.
AppVersion string
WickVersion string
Commit string
BuildTime string
}
SystemConfig carries the System-page dependencies into the admin Handler. Grouped so NewHandler doesn't grow a long tail of positional params each time the page needs another build field.
type TagUsage ¶ added in v1.2.9
type TagUsage struct {
TagID string `json:"tag_id"`
TagName string `json:"tag_name"`
UserCount int `json:"user_count"`
ItemCount int `json:"item_count"`
Users []adminUser `json:"users,omitempty"`
Items []AccessItem `json:"items,omitempty"`
Groups []AccessItemGroup `json:"groups,omitempty"`
}
TagUsage is the counters shown on the Tags page plus the detail behind them.
type ToolPerm ¶
type ToolPerm struct {
Path string
Visibility entity.ToolVisibility
Disabled bool
TagIDs []string
}
type WorkflowInfo ¶ added in v0.17.0
WorkflowInfo carries the fields the admin page needs for a workflow row.
type WorkflowLister ¶ added in v0.17.0
type WorkflowLister interface {
List() ([]string, error)
LoadInfo(id string) (WorkflowInfo, error)
}
WorkflowLister lists workflow IDs and loads individual workflow metadata.
type WorkflowOwnerWriter ¶ added in v1.2.9
WorkflowOwnerWriter re-stamps a workflow's owner. Optional, like ProjectWriter: nil leaves the Owner column a label instead of a picker, which is the right answer for a file-backed install where there is no row to re-stamp.
Source Files
¶
- access.go
- access_cache.go
- access_repo.go
- access_rules.go
- access_tokens.go
- analytics.go
- analytics_cache.go
- async_save.go
- connections.go
- connectors.go
- handler.go
- handler_configs.go
- handler_system.go
- impersonate.go
- lan.go
- owner.go
- pending_swap.go
- providers.go
- repo.go
- resources.go
- schedules.go
- spa.go
- spa_handler.go
- static.go
- tag_form.go