Rename Topic to TopicPattern in Grant
This commit is contained in:
parent
c56814e7da
commit
936e95fd9e
3 changed files with 10 additions and 10 deletions
|
@ -63,7 +63,7 @@ type User struct {
|
||||||
|
|
||||||
// Grant is a struct that represents an access control entry to a topic
|
// Grant is a struct that represents an access control entry to a topic
|
||||||
type Grant struct {
|
type Grant struct {
|
||||||
Topic string
|
TopicPattern string // May include wildcard (*)
|
||||||
Read bool
|
Read bool
|
||||||
Write bool
|
Write bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,7 @@ func (a *SQLiteAuth) readGrants(username string) ([]Grant, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
grants = append(grants, Grant{
|
grants = append(grants, Grant{
|
||||||
Topic: fromSQLWildcard(topic),
|
TopicPattern: fromSQLWildcard(topic),
|
||||||
Read: read,
|
Read: read,
|
||||||
Write: write,
|
Write: write,
|
||||||
})
|
})
|
||||||
|
|
|
@ -145,13 +145,13 @@ func showUsers(c *cli.Context, manager auth.Manager, users []*auth.User) error {
|
||||||
} else if len(user.Grants) > 0 {
|
} else if len(user.Grants) > 0 {
|
||||||
for _, grant := range user.Grants {
|
for _, grant := range user.Grants {
|
||||||
if grant.Read && grant.Write {
|
if grant.Read && grant.Write {
|
||||||
fmt.Fprintf(c.App.ErrWriter, "- read-write access to topic %s\n", grant.Topic)
|
fmt.Fprintf(c.App.ErrWriter, "- read-write access to topic %s\n", grant.TopicPattern)
|
||||||
} else if grant.Read {
|
} else if grant.Read {
|
||||||
fmt.Fprintf(c.App.ErrWriter, "- read-only access to topic %s\n", grant.Topic)
|
fmt.Fprintf(c.App.ErrWriter, "- read-only access to topic %s\n", grant.TopicPattern)
|
||||||
} else if grant.Write {
|
} else if grant.Write {
|
||||||
fmt.Fprintf(c.App.ErrWriter, "- write-only access to topic %s\n", grant.Topic)
|
fmt.Fprintf(c.App.ErrWriter, "- write-only access to topic %s\n", grant.TopicPattern)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(c.App.ErrWriter, "- no access to topic %s\n", grant.Topic)
|
fmt.Fprintf(c.App.ErrWriter, "- no access to topic %s\n", grant.TopicPattern)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue