feat(config): add repo collabs

Ayman Bagabas created

A repo config now can take a list of collab user names.

Change summary

config/auth.go   |  5 +++++
config/config.go | 11 ++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)

Detailed changes

config/auth.go 🔗

@@ -120,6 +120,11 @@ OUT:
 		if anon > ac {
 			ac = anon
 		}
+		for _, c := range r.Collabs {
+			if c == u.Name {
+				return ac
+			}
+		}
 		for _, rr := range u.CollabRepos {
 			if rr == r.Repo {
 				return ac

config/config.go 🔗

@@ -51,11 +51,12 @@ type User struct {
 
 // RepoConfig is a repository configuration.
 type RepoConfig struct {
-	Name    string `yaml:"name" json:"name"`
-	Repo    string `yaml:"repo" json:"repo"`
-	Note    string `yaml:"note" json:"note"`
-	Private bool   `yaml:"private" json:"private"`
-	Readme  string `yaml:"readme" json:"readme"`
+	Name    string   `yaml:"name" json:"name"`
+	Repo    string   `yaml:"repo" json:"repo"`
+	Note    string   `yaml:"note" json:"note"`
+	Private bool     `yaml:"private" json:"private"`
+	Readme  string   `yaml:"readme" json:"readme"`
+	Collabs []string `yaml:"collabs" json:"collabs"`
 }
 
 // NewConfig creates a new internal Config struct.