Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
cashier
Commits
b6774574
Commit
b6774574
authored
Jan 22, 2017
by
Kevin Lyda
💬
Browse files
Remove the level config stuff.
parent
7f3d3abd
Pipeline
#1161
failed with stage
in 2 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
server/auth/gitlab/gitlab.go
View file @
b6774574
...
...
@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"net/http"
"strconv"
"github.com/nsheridan/cashier/server/auth"
"github.com/nsheridan/cashier/server/config"
...
...
@@ -23,19 +22,10 @@ type Config struct {
config
*
oauth2
.
Config
baseurl
string
group
string
level
int
whitelist
map
[
string
]
bool
allusers
bool
}
var
levelMap
=
map
[
string
]
int
{
"guest"
:
10
,
"reporter"
:
20
,
"developer"
:
30
,
"master"
:
40
,
"owner"
:
50
,
}
// New creates a new Gitlab provider from a configuration.
func
New
(
c
*
config
.
Auth
)
(
auth
.
Provider
,
error
)
{
uw
:=
make
(
map
[
string
]
bool
)
...
...
@@ -56,16 +46,7 @@ func New(c *config.Auth) (auth.Provider, error) {
return
nil
,
errors
.
New
(
"gitlab_opts siteurl must end in /"
)
}
}
levelOpt
:=
0
if
c
.
ProviderOpts
[
"level"
]
!=
""
{
levelOpt
=
levelMap
[
c
.
ProviderOpts
[
"level"
]]
if
levelOpt
==
0
{
var
err
error
if
levelOpt
,
err
=
strconv
.
Atoi
(
c
.
ProviderOpts
[
"level"
]);
err
!=
nil
{
return
nil
,
errors
.
New
(
"gitlab_opts level unrecognised; must be number or text level"
)
}
}
}
return
&
Config
{
config
:
&
oauth2
.
Config
{
ClientID
:
c
.
OauthClientID
,
...
...
@@ -80,7 +61,6 @@ func New(c *config.Auth) (auth.Provider, error) {
},
},
group
:
c
.
ProviderOpts
[
"group"
],
level
:
levelOpt
,
whitelist
:
uw
,
allusers
:
allUsers
,
baseurl
:
siteUrl
+
"api/v3/"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment