Forráskód Böngészése

Rename Topic to TopicPattern in Grant

Philipp Heckel 4 éve
szülő
commit
936e95fd9e
3 módosított fájl, 10 hozzáadás és 10 törlés
  1. 3 3
      auth/auth.go
  2. 3 3
      auth/auth_sqlite.go
  3. 4 4
      cmd/access.go

+ 3 - 3
auth/auth.go

@@ -63,9 +63,9 @@ type User struct {
 
 // Grant is a struct that represents an access control entry to a topic
 type Grant struct {
-	Topic string
-	Read  bool
-	Write bool
+	TopicPattern string // May include wildcard (*)
+	Read         bool
+	Write        bool
 }
 
 // Permission represents a read or write permission to a topic

+ 3 - 3
auth/auth_sqlite.go

@@ -280,9 +280,9 @@ func (a *SQLiteAuth) readGrants(username string) ([]Grant, error) {
 			return nil, err
 		}
 		grants = append(grants, Grant{
-			Topic: fromSQLWildcard(topic),
-			Read:  read,
-			Write: write,
+			TopicPattern: fromSQLWildcard(topic),
+			Read:         read,
+			Write:        write,
 		})
 	}
 	return grants, nil

+ 4 - 4
cmd/access.go

@@ -145,13 +145,13 @@ func showUsers(c *cli.Context, manager auth.Manager, users []*auth.User) error {
 		} else if len(user.Grants) > 0 {
 			for _, grant := range user.Grants {
 				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 {
-					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 {
-					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 {
-					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 {