feat(approvals): add a People page, leave channel approvals unchanged, make a binding's target optional (#2072)
This commit is contained in:
8 files changed
+214
-10
No files matched your search
@@ -377,10 +377,6 @@ func (m *Module) Settle(ctx context.Context, id uuid.UUID, identity, via string,
|
||||
return false, err
|
||||
}
|
||||
who, err := m.verify(ctx, identity, row)
|
||||
if err == nil && approved && row.Irreversible {
|
||||
// A channel message can't carry a passkey assertion.
|
||||
err = ErrNeedsFreshAuthentication
|
||||
}
|
||||
if refusal(err) {
|
||||
m.log.WarnContext(ctx, "approval answer refused", "request", id, "identity", identity, "reason", err.Error())
|
||||
return false, m.store.Refuse(ctx, store.Refusal{
|
||||
|
||||
@@ -93,8 +93,6 @@ func (b Binding) complete() error {
|
||||
missing = "action"
|
||||
case len(bytes.TrimSpace(b.Input)) == 0:
|
||||
missing = "arguments"
|
||||
case b.Target.Kind == "" || b.Target.ID == "":
|
||||
missing = "target"
|
||||
case b.Approvers == nil:
|
||||
missing = "approvers"
|
||||
case b.Expires.IsZero():
|
||||
|
||||
@@ -64,6 +64,7 @@ func TestBindingDigestCoversTheWholeAction(t *testing.T) {
|
||||
{"the action", func(b *Binding) { b.Action = "forward" }},
|
||||
{"the arguments", func(b *Binding) { b.Input = jsontext.Value(`{"to":"b@example.com","body":"hi"}`) }},
|
||||
{"the target's id", func(b *Binding) { b.Target.ID = "outbox" }},
|
||||
{"a target removed", func(b *Binding) { b.Target = connectors.Target{} }},
|
||||
{"the target's environment", func(b *Binding) { b.Target.Environment = "dev" }},
|
||||
{"the effect", func(b *Binding) { b.Effect.Reversibility = connectors.Recoverable }},
|
||||
{"the approvers", func(b *Binding) { b.Approvers = []string{bob} }},
|
||||
@@ -103,8 +104,6 @@ func TestBindingDigestCoversTheWholeAction(t *testing.T) {
|
||||
{"connector", func(b *Binding) { b.Connector = "" }},
|
||||
{"action", func(b *Binding) { b.Action = "" }},
|
||||
{"arguments", func(b *Binding) { b.Input = nil }},
|
||||
{"target kind", func(b *Binding) { b.Target.Kind = "" }},
|
||||
{"target id", func(b *Binding) { b.Target.ID = "" }},
|
||||
{"approvers", func(b *Binding) { b.Approvers = nil }},
|
||||
{"expiry", func(b *Binding) { b.Expires = time.Time{} }},
|
||||
}
|
||||
@@ -262,6 +261,16 @@ func TestRunApprovedRunsOnlyWhatWasApprovedAndOnlyOnce(t *testing.T) {
|
||||
},
|
||||
wantDiscard: "its target changed",
|
||||
},
|
||||
{
|
||||
name: "a target appeared where there was none",
|
||||
change: func(f *approvalFixture) {
|
||||
b := baseBinding()
|
||||
b.Target = connectors.Target{}
|
||||
f.action.Binding, _ = json.Marshal(b)
|
||||
f.action.BindingDigest, _ = b.Digest()
|
||||
},
|
||||
wantDiscard: "its target changed",
|
||||
},
|
||||
{
|
||||
name: "the target changed and would now run unattended",
|
||||
change: func(f *approvalFixture) {
|
||||
|
||||
@@ -612,7 +612,7 @@ func (m *Module) capabilities(ctx context.Context, _ *struct{}) (*httpapi.Reply[
|
||||
p, signedIn := PrincipalFromContext(ctx)
|
||||
sections := map[string]bool{"chat": signedIn, "memory": signedIn}
|
||||
for _, name := range []string{
|
||||
"settings", "events", "workflows", "runs", "credentials", "extensions", "secret_engines", "models", "controls", "memory_admin",
|
||||
"settings", "org_people", "events", "workflows", "runs", "credentials", "extensions", "secret_engines", "models", "controls", "memory_admin",
|
||||
} {
|
||||
sections[name] = p.InstanceAdmin()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user