Documentation
¶
Index ¶
- Constants
- type ChangeNotifier
- type Repository
- type Server
- func (s *Server) CreateSingleCommandPermission(ctx context.Context, ...) (*connect.Response[taskguildv1.CreateSingleCommandPermissionResponse], error)
- func (s *Server) DeleteSingleCommandPermission(ctx context.Context, ...) (*connect.Response[taskguildv1.DeleteSingleCommandPermissionResponse], error)
- func (s *Server) ListSingleCommandPermissions(ctx context.Context, ...) (*connect.Response[taskguildv1.ListSingleCommandPermissionsResponse], error)
- func (s *Server) UpdateSingleCommandPermission(ctx context.Context, ...) (*connect.Response[taskguildv1.UpdateSingleCommandPermissionResponse], error)
- type SingleCommandPermission
Constants ¶
const ( TypeCommand = "command" TypeRedirect = "redirect" )
Permission types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeNotifier ¶
type ChangeNotifier interface {
NotifySingleCommandPermissionChange(projectID string)
}
ChangeNotifier is called after permission creates/updates/deletes to push updates to connected Agent Managers so they can refresh their caches.
type Repository ¶
type Repository interface {
// Create stores a new permission rule.
Create(ctx context.Context, p *SingleCommandPermission) error
// Get returns a single permission rule by ID.
// Returns an error if the rule does not exist.
Get(ctx context.Context, id string) (*SingleCommandPermission, error)
// List returns all permission rules for a project.
List(ctx context.Context, projectID string) ([]*SingleCommandPermission, error)
// FindByPatternAndType returns all permission rules that match the given
// projectID, pattern, and type combination. Returns an empty slice if none
// found. Results are sorted by CreatedAt ascending (oldest first).
FindByPatternAndType(ctx context.Context, projectID, pattern, permType string) ([]*SingleCommandPermission, error)
// Update replaces an existing permission rule.
Update(ctx context.Context, p *SingleCommandPermission) error
// Delete removes a permission rule by ID.
Delete(ctx context.Context, id string) error
}
Repository provides persistence for single-command permission rules.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the SingleCommandPermissionService RPC handlers.
func NewServer ¶
func NewServer(repo Repository, notifier ChangeNotifier) *Server
NewServer creates a new single-command permission service server.
func (*Server) CreateSingleCommandPermission ¶
func (s *Server) CreateSingleCommandPermission( ctx context.Context, req *connect.Request[taskguildv1.CreateSingleCommandPermissionRequest], ) (*connect.Response[taskguildv1.CreateSingleCommandPermissionResponse], error)
CreateSingleCommandPermission adds a new wildcard permission rule. If a rule with the same pattern+type already exists in the project, the existing rule is updated (label overwrite) and any extra duplicates are removed. This makes the operation idempotent and cleans up legacy duplicates.
func (*Server) DeleteSingleCommandPermission ¶
func (s *Server) DeleteSingleCommandPermission( ctx context.Context, req *connect.Request[taskguildv1.DeleteSingleCommandPermissionRequest], ) (*connect.Response[taskguildv1.DeleteSingleCommandPermissionResponse], error)
DeleteSingleCommandPermission removes a permission rule.
func (*Server) ListSingleCommandPermissions ¶
func (s *Server) ListSingleCommandPermissions( ctx context.Context, req *connect.Request[taskguildv1.ListSingleCommandPermissionsRequest], ) (*connect.Response[taskguildv1.ListSingleCommandPermissionsResponse], error)
ListSingleCommandPermissions returns all rules for a project.
func (*Server) UpdateSingleCommandPermission ¶
func (s *Server) UpdateSingleCommandPermission( ctx context.Context, req *connect.Request[taskguildv1.UpdateSingleCommandPermissionRequest], ) (*connect.Response[taskguildv1.UpdateSingleCommandPermissionResponse], error)
UpdateSingleCommandPermission modifies an existing permission rule.
type SingleCommandPermission ¶
type SingleCommandPermission struct {
ID string `yaml:"id"`
ProjectID string `yaml:"project_id"`
Pattern string `yaml:"pattern"` // wildcard pattern (e.g. "git status" or "git *")
Type string `yaml:"type"` // "command" or "redirect"
Label string `yaml:"label"` // human-readable label (e.g. "git status")
CreatedAt time.Time `yaml:"created_at"`
}
SingleCommandPermission represents a wildcard-based permission rule that matches against individual shell commands (not full one-liners). The pattern uses wildcard syntax where `*` matches zero or more arbitrary characters.