24 lines
609 B
Go
24 lines
609 B
Go
package event
|
|
|
|
import (
|
|
"github.com/cortezaproject/corteza-server/compose/types"
|
|
"github.com/cortezaproject/corteza-server/pkg/eventbus"
|
|
)
|
|
|
|
// Match returns false if given conditions do not match event & resource internals
|
|
func (res namespaceBase) Match(c eventbus.ConstraintMatcher) bool {
|
|
return namespaceMatch(res.namespace, c, false)
|
|
}
|
|
|
|
// Handles namespace matchers
|
|
func namespaceMatch(r *types.Namespace, c eventbus.ConstraintMatcher, def bool) bool {
|
|
switch c.Name() {
|
|
case "namespace", "namespace.slug":
|
|
return c.Match(r.Slug)
|
|
case "namespace.name":
|
|
return c.Match(r.Name)
|
|
}
|
|
|
|
return def
|
|
}
|