Skip to content
Snippets Groups Projects
Commit e1b780c4 authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Rename organisation to group.

parent 0ec8b5c8
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -20,7 +20,7 @@ const ( ...@@ -20,7 +20,7 @@ const (
// Gitlab account. // Gitlab account.
type Config struct { type Config struct {
config *oauth2.Config config *oauth2.Config
organisation string group string
whitelist map[string]bool whitelist map[string]bool
allusers bool allusers bool
} }
...@@ -35,8 +35,8 @@ func New(c *config.Auth) (auth.Provider, error) { ...@@ -35,8 +35,8 @@ func New(c *config.Auth) (auth.Provider, error) {
if c.ProviderOpts["allusers"] == "true" { if c.ProviderOpts["allusers"] == "true" {
allUsers = true allUsers = true
} }
if !allUsers && c.ProviderOpts["organisation"] == "" && len(uw) == 0 { if !allUsers && c.ProviderOpts["group"] == "" && len(uw) == 0 {
return nil, errors.New("gitlab_opts organisation and the users whitelist must not be both empty if allusers isn't true") return nil, errors.New("gitlab_opts group and the users whitelist must not be both empty if allusers isn't true")
} }
if c.ProviderOpts["authurl"] == "" || c.ProviderOpts["tokenurl"] == "" { if c.ProviderOpts["authurl"] == "" || c.ProviderOpts["tokenurl"] == "" {
return nil, errors.New("gitlab_opts authurl and tokenurl must be set") return nil, errors.New("gitlab_opts authurl and tokenurl must be set")
...@@ -54,7 +54,7 @@ func New(c *config.Auth) (auth.Provider, error) { ...@@ -54,7 +54,7 @@ func New(c *config.Auth) (auth.Provider, error) {
"api", "api",
}, },
}, },
organisation: c.ProviderOpts["organisation"], group: c.ProviderOpts["group"],
whitelist: uw, whitelist: uw,
allusers: allUsers, allusers: allUsers,
}, nil }, nil
...@@ -81,8 +81,8 @@ func (c *Config) Valid(token *oauth2.Token) bool { ...@@ -81,8 +81,8 @@ func (c *Config) Valid(token *oauth2.Token) bool {
if !token.Valid() { if !token.Valid() {
return false return false
} }
if c.organisation == "" { if c.group == "" {
// There's no organisation and token is valid. Can only reach // There's no group and token is valid. Can only reach
// here if user whitelist is set and user is in whitelist. // here if user whitelist is set and user is in whitelist.
return true return true
} }
...@@ -92,7 +92,7 @@ func (c *Config) Valid(token *oauth2.Token) bool { ...@@ -92,7 +92,7 @@ func (c *Config) Valid(token *oauth2.Token) bool {
return false return false
} }
for _, g := range groups { for _, g := range groups {
if g.Name == c.organisation { if g.Name == c.group {
return true return true
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment