Support multiple IDs in grants (#3263)

This allows specifying multiple IDs in grants via an `ids` field, which
will eventually become the normal way to specify IDs. Internally, each
grant with multiple IDs turns into multiple ACL grants each with a
single ID; to make this distinction clearer and allow for better
separation of concerns an AclGrant type has been introduced, so really
multiple IDs in a Grant turn into multiple AclGrants.

The nice thing about doing it this way is that it becomes purely a
parsing concern; no actual validation logic has changed.

For backwards compatibility with grants already stored in roles, we do
not error out if `id` is specified. However, eventually we will simply
not support grants with `id` coming via the API; they will fail API
validation, such that new grants will require the use of the updated
`ids` field.

A follow-on PR will plumb this through the service handlers/API/CLI, but
I decided to do it in separate chunks to make reviewing easier, given
that they are easily separable into the internal and external aspects of
the change.

* Add CLI/API checks around using ID in grants (#3264)

* Plumb through some contexts to remove a lot of deprecated errors (#3268)
This commit is contained in:
Jeff Mitchell committed 2023-06-14 21:55:24 -04:00
1 parent 8acc73dc6e
commit feb3aea38f
25 files changed
+1043 -381

No files matched your search

+7
View File
@@ -21,6 +21,7 @@ const (
UseTargetIdForHostId
RequireVersionInWorkerInfo
SshSessionRecording
SupportIdInGrants
)
var featureMap map[Feature]MetadataConstraint
@@ -72,6 +73,12 @@ func init() {
featureMap[SshSessionRecording] = MetadataConstraint{
Constraints: mustNewConstraints(">= 0.13.0"),
}
// Warn until 0.15 about using the now-deprecated id field in grants; after
// that disallow it
featureMap[SupportIdInGrants] = MetadataConstraint{
Constraints: mustNewConstraints("< 0.15.0"),
}
}
func mustNewConstraints(v string) gvers.Constraints {