-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various event-related fixes and improvements #2565
Various event-related fixes and improvements #2565
Conversation
6ff505d
to
24233f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passes sanity check, but needs @htdvisser approval as he may have had some ideas around event start/stop and API behavior
if len(req.Identifiers) == 0 { | ||
return nil | ||
return errNoIdentifiers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an API behavioral change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this fall under these two:
- We will not break the API between components and events within minor versions. So at least the same minor versions of components are compatible with each other.
- We reserve the right to fix bugs in API, configuration and storage in patches and minor updates. This may break components, gateways and applications that rely on buggy behavior.
IMO silently failing here is a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a bug report that is referenced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -45,7 +45,6 @@ func unmarshalContext(ctx context.Context, data map[string][]byte) (context.Cont | |||
if err != nil { | |||
return nil, err | |||
} | |||
delete(data, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes that unmarshalContext
and marshalContext
are no longer symmetric. Not sure if that was intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed that
for _, entityIDs := range evt.Identifiers() { | ||
// EventIsVisible returns whether ev is visible given rights in the context. | ||
func EventIsVisible(ctx context.Context, ev events.Event) (bool, error) { | ||
visibility := ev.Visibility().Implied() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct in this context.
Maybe Implied()
is a bit confusing. If a user has the "admin right", that implies that the user has all rights. If an event is visible to callers with the "admin right", that doesn't mean it's also visible to the implicit rights (i.e. for a caller with only the "info right").
67bc32f
to
9c2e8a1
Compare
9c2e8a1
to
c814274
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code owned files LGTM
Summary
References https://github.com/TheThingsIndustries/lorawan-stack/pull/2096
Close #2569
Changes
rightsutil.EventIsVisible
test.AllTrue
and use in NSChecklist
README.md
. The target branch is set tomaster
if the changes are fully compatible with existing API, database, configuration and CLI.CHANGELOG.md
.CONTRIBUTING.md
, there are no fixup commits left.