Review related changes

This commit is contained in:
Patrick Pacher 2020-09-22 16:51:26 +02:00
parent 1b55c73559
commit 0464f5be48
No known key found for this signature in database
GPG key ID: E8CD2DA160925A6D
2 changed files with 10 additions and 6 deletions

View file

@ -70,7 +70,7 @@ func (mng *Manager) Start() error {
configKeyPrefixes[sub.ConfigKeySpace] = sub configKeyPrefixes[sub.ConfigKeySpace] = sub
} }
// aggmngate all modules dependencies (and the subsystem module itself) // aggregate all modules dependencies (and the subsystem module itself)
// into the Modules slice. Configuration options form dependened modules // into the Modules slice. Configuration options form dependened modules
// will be marked using config.SubsystemAnnotation if not already set. // will be marked using config.SubsystemAnnotation if not already set.
for _, sub := range mng.subsys { for _, sub := range mng.subsys {

View file

@ -216,14 +216,18 @@ func (r *Registry) Query(q *query.Query, local, internal bool) (*iterator.Iterat
for _, r := range records { for _, r := range records {
r.Lock() r.Lock()
var ( var (
matchesKey = q.MatchesKey(r.DatabaseKey()) matchesKey = q.MatchesKey(r.DatabaseKey())
isValid = r.Meta().CheckValidity() isValid = r.Meta().CheckValidity()
isAllowed = r.Meta().CheckPermission(local, internal) isAllowed = r.Meta().CheckPermission(local, internal)
matchesRecord = q.MatchesRecord(r)
allowed = matchesKey && isValid && isAllowed
) )
if allowed {
allowed = q.MatchesRecord(r)
}
r.Unlock() r.Unlock()
if !(matchesKey && isValid && isAllowed && matchesRecord) { if !allowed {
continue continue
} }