diff --git a/src/internal/scopes.zig b/src/internal/scopes.zig index 3144484..b40d9a9 100644 --- a/src/internal/scopes.zig +++ b/src/internal/scopes.zig @@ -399,3 +399,13 @@ test "identity scopes constrain attribute" { try std.testing.expect(!identityAllows("identity:handle", .wildcard)); try std.testing.expect(identityAllows("identity:*", .wildcard)); } + +test "a permission-set expansion with collections grants space manage actions" { + const scope = "atproto space:tech.waow.lore.space?authority=*&skey=*&collection=tech.waow.lore.entry&collection=tech.waow.lore.registry&action=read&action=create&action=update&action=delete&manage=create&manage=update&manage=delete"; + const did = "did:plc:siv7zbedip4vcet4v67piibr"; + try std.testing.expect(spaceAllows(scope, .manage_update, "tech.waow.lore.space", did, "1d5d7c37", null)); + try std.testing.expect(spaceAllows(scope, .manage_create, "tech.waow.lore.space", did, "1d5d7c37", null)); + try std.testing.expect(spaceAllows(scope, .create, "tech.waow.lore.space", did, "1d5d7c37", "tech.waow.lore.entry")); + try std.testing.expect(!spaceAllows(scope, .create, "tech.waow.lore.space", did, "1d5d7c37", "tech.waow.other")); + try std.testing.expect(!spaceAllows(scope, .manage_update, "tech.waow.memory.space", did, "1d5d7c37", null)); +}