chore(deps): update golangci/golangci-lint docker tag to v1.56.2 (#2099)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2099 Co-authored-by: renovate <renovatebot@kolaente.de> Co-committed-by: renovate <renovatebot@kolaente.de>
This commit is contained in:
parent
1d5517b53a
commit
d7fdefcead
@ -139,7 +139,7 @@ steps:
|
|||||||
event: [ push, tag, pull_request ]
|
event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
- name: api-lint
|
- name: api-lint
|
||||||
image: golangci/golangci-lint:v1.55.2
|
image: golangci/golangci-lint:v1.56.2
|
||||||
pull: always
|
pull: always
|
||||||
environment:
|
environment:
|
||||||
GOPROXY: 'https://goproxy.kolaente.de'
|
GOPROXY: 'https://goproxy.kolaente.de'
|
||||||
@ -1401,6 +1401,6 @@ steps:
|
|||||||
- failure
|
- failure
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: bd616ecf66fe95bd25c5f4bd73fc9ccfc20601a87a4f8dd4574d66393eacd077
|
hmac: a5d31a6cb5eb6482e72bea619ee391ff2b8118b9865e3896a607b8a7e874a797
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -99,3 +99,7 @@ issues:
|
|||||||
- path: pkg/modules/migration/ticktick/ticktick_test.go
|
- path: pkg/modules/migration/ticktick/ticktick_test.go
|
||||||
linters:
|
linters:
|
||||||
- testifylint
|
- testifylint
|
||||||
|
- path: pkg/migration/*
|
||||||
|
text: "parameter 'tx' seems to be unused, consider removing or renaming it as"
|
||||||
|
linters:
|
||||||
|
- revive
|
||||||
|
@ -415,7 +415,7 @@ func checkGolangCiLintInstalled() {
|
|||||||
mg.Deps(initVars)
|
mg.Deps(initVars)
|
||||||
if err := exec.Command("golangci-lint").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") {
|
if err := exec.Command("golangci-lint").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") {
|
||||||
fmt.Println("Please manually install golangci-lint by running")
|
fmt.Println("Please manually install golangci-lint by running")
|
||||||
fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2")
|
fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ func init() {
|
|||||||
var dumpCmd = &cobra.Command{
|
var dumpCmd = &cobra.Command{
|
||||||
Use: "dump",
|
Use: "dump",
|
||||||
Short: "Dump all vikunja data into a zip file. Includes config, files and db.",
|
Short: "Dump all vikunja data into a zip file. Includes config, files and db.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInitWithoutAsync()
|
initialize.FullInitWithoutAsync()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
filename := "vikunja-dump_" + time.Now().Format("2006-01-02_15-03-05") + ".zip"
|
filename := "vikunja-dump_" + time.Now().Format("2006-01-02_15-03-05") + ".zip"
|
||||||
if err := dump.Dump(filename); err != nil {
|
if err := dump.Dump(filename); err != nil {
|
||||||
log.Critical(err.Error())
|
log.Critical(err.Error())
|
||||||
|
@ -32,10 +32,10 @@ func init() {
|
|||||||
var indexCmd = &cobra.Command{
|
var indexCmd = &cobra.Command{
|
||||||
Use: "index",
|
Use: "index",
|
||||||
Short: "Reindex all of Vikunja's data into Typesense. This will remove any existing index.",
|
Short: "Reindex all of Vikunja's data into Typesense. This will remove any existing index.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInitWithoutAsync()
|
initialize.FullInitWithoutAsync()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
if config.TypesenseURL.GetString() == "" {
|
if config.TypesenseURL.GetString() == "" {
|
||||||
log.Error("Typesense not configured")
|
log.Error("Typesense not configured")
|
||||||
return
|
return
|
||||||
@ -61,10 +61,10 @@ var indexCmd = &cobra.Command{
|
|||||||
var partialReindexCmd = &cobra.Command{
|
var partialReindexCmd = &cobra.Command{
|
||||||
Use: "partial-index",
|
Use: "partial-index",
|
||||||
Short: "Reindex any tasks which were not indexed yet into Typesense. This will not remove any existing index.",
|
Short: "Reindex any tasks which were not indexed yet into Typesense. This will not remove any existing index.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInitWithoutAsync()
|
initialize.FullInitWithoutAsync()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
if config.TypesenseURL.GetString() == "" {
|
if config.TypesenseURL.GetString() == "" {
|
||||||
log.Error("Typesense not configured")
|
log.Error("Typesense not configured")
|
||||||
return
|
return
|
||||||
|
@ -36,10 +36,10 @@ func init() {
|
|||||||
var migrateCmd = &cobra.Command{
|
var migrateCmd = &cobra.Command{
|
||||||
Use: "migrate",
|
Use: "migrate",
|
||||||
Short: "Run all database migrations which didn't already run.",
|
Short: "Run all database migrations which didn't already run.",
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.LightInit()
|
initialize.LightInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
migration.Migrate(nil)
|
migration.Migrate(nil)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ var migrateCmd = &cobra.Command{
|
|||||||
var migrateListCmd = &cobra.Command{
|
var migrateListCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "Show a list with all database migrations.",
|
Short: "Show a list with all database migrations.",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
migration.ListMigrations()
|
migration.ListMigrations()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ var rollbackUntilFlag string
|
|||||||
var migrationRollbackCmd = &cobra.Command{
|
var migrationRollbackCmd = &cobra.Command{
|
||||||
Use: "rollback",
|
Use: "rollback",
|
||||||
Short: "Roll migrations back until a certain point.",
|
Short: "Roll migrations back until a certain point.",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
migration.Rollback(rollbackUntilFlag)
|
migration.Rollback(rollbackUntilFlag)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,10 @@ var restoreCmd = &cobra.Command{
|
|||||||
Use: "restore [filename]",
|
Use: "restore [filename]",
|
||||||
Short: "Restores all vikunja data from a vikunja dump.",
|
Short: "Restores all vikunja data from a vikunja dump.",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInitWithoutAsync()
|
initialize.FullInitWithoutAsync()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
if err := dump.Restore(args[0]); err != nil {
|
if err := dump.Restore(args[0]); err != nil {
|
||||||
log.Critical(err.Error())
|
log.Critical(err.Error())
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ var testmailCmd = &cobra.Command{
|
|||||||
Use: "testmail [email]",
|
Use: "testmail [email]",
|
||||||
Short: "Send a test mail using the configured smtp connection",
|
Short: "Send a test mail using the configured smtp connection",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.LightInit()
|
initialize.LightInit()
|
||||||
|
|
||||||
// Start the mail daemon
|
// Start the mail daemon
|
||||||
mail.StartMailDaemon()
|
mail.StartMailDaemon()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
log.Info("Sending testmail...")
|
log.Info("Sending testmail...")
|
||||||
message := notifications.NewMail().
|
message := notifications.NewMail().
|
||||||
From("Vikunja <"+config.MailerFromEmail.GetString()+">").
|
From("Vikunja <"+config.MailerFromEmail.GetString()+">").
|
||||||
|
@ -128,10 +128,10 @@ var userCmd = &cobra.Command{
|
|||||||
var userListCmd = &cobra.Command{
|
var userListCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "Shows a list of all users.",
|
Short: "Shows a list of all users.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -173,10 +173,10 @@ var userListCmd = &cobra.Command{
|
|||||||
var userCreateCmd = &cobra.Command{
|
var userCreateCmd = &cobra.Command{
|
||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new user.",
|
Short: "Create a new user.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -214,10 +214,10 @@ var userUpdateCmd = &cobra.Command{
|
|||||||
Use: "update [user id]",
|
Use: "update [user id]",
|
||||||
Short: "Update an existing user.",
|
Short: "Update an existing user.",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -250,11 +250,11 @@ var userUpdateCmd = &cobra.Command{
|
|||||||
var userResetPasswordCmd = &cobra.Command{
|
var userResetPasswordCmd = &cobra.Command{
|
||||||
Use: "reset-password [user id]",
|
Use: "reset-password [user id]",
|
||||||
Short: "Reset a users password, either through mailing them a reset link or directly.",
|
Short: "Reset a users password, either through mailing them a reset link or directly.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -286,11 +286,11 @@ var userResetPasswordCmd = &cobra.Command{
|
|||||||
var userChangeStatusCmd = &cobra.Command{
|
var userChangeStatusCmd = &cobra.Command{
|
||||||
Use: "change-status [user id]",
|
Use: "change-status [user id]",
|
||||||
Short: "Enable or disable a user. Will toggle the current status if no flag (--enable or --disable) is provided.",
|
Short: "Enable or disable a user. Will toggle the current status if no flag (--enable or --disable) is provided.",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -327,10 +327,10 @@ var userDeleteCmd = &cobra.Command{
|
|||||||
Short: "Delete an existing user.",
|
Short: "Delete an existing user.",
|
||||||
Long: "Kick off the user deletion process. If call without the --now flag, this command will only trigger an email to the user in order for them to confirm and start the deletion process. With the flag the user is deleted immediately. USE WITH CAUTION.",
|
Long: "Kick off the user deletion process. If call without the --now flag, this command will only trigger an email to the user in order for them to confirm and start the deletion process. With the flag the user is deleted immediately. USE WITH CAUTION.",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
if userFlagDeleteNow && !userFlagDeleteConfirm {
|
if userFlagDeleteNow && !userFlagDeleteConfirm {
|
||||||
fmt.Println("You requested to delete the user immediately. Are you sure?")
|
fmt.Println("You requested to delete the user immediately. Are you sure?")
|
||||||
fmt.Println(`To confirm, please type "yes, I confirm" in all uppercase:`)
|
fmt.Println(`To confirm, please type "yes, I confirm" in all uppercase:`)
|
||||||
|
@ -31,7 +31,7 @@ func init() {
|
|||||||
var versionCmd = &cobra.Command{
|
var versionCmd = &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Print the version number of Vikunja",
|
Short: "Print the version number of Vikunja",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
fmt.Printf("Vikunja api version %s\n", version.Version)
|
fmt.Printf("Vikunja api version %s\n", version.Version)
|
||||||
fmt.Printf("Built with %s\n", runtime.Version())
|
fmt.Printf("Built with %s\n", runtime.Version())
|
||||||
},
|
},
|
||||||
|
@ -67,10 +67,10 @@ func setupUnixSocket(e *echo.Echo) error {
|
|||||||
var webCmd = &cobra.Command{
|
var webCmd = &cobra.Command{
|
||||||
Use: "web",
|
Use: "web",
|
||||||
Short: "Starts the rest api web server",
|
Short: "Starts the rest api web server",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(_ *cobra.Command, _ []string) {
|
||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
|
|
||||||
// Version notification
|
// Version notification
|
||||||
log.Infof("Vikunja version %s", version.Version)
|
log.Infof("Vikunja version %s", version.Version)
|
||||||
|
@ -120,7 +120,7 @@ func addUserTokenToContext(t *testing.T, user *user.User, c echo.Context) {
|
|||||||
token, err := auth.NewUserJWTAuthtoken(user, false)
|
token, err := auth.NewUserJWTAuthtoken(user, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// We send the string token through the parsing function to get a valid jwt.Token
|
// We send the string token through the parsing function to get a valid jwt.Token
|
||||||
tken, err := jwt.Parse(token, func(t *jwt.Token) (interface{}, error) {
|
tken, err := jwt.Parse(token, func(_ *jwt.Token) (interface{}, error) {
|
||||||
return []byte(config.ServiceJWTSecret.GetString()), nil
|
return []byte(config.ServiceJWTSecret.GetString()), nil
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -132,7 +132,7 @@ func addLinkShareTokenToContext(t *testing.T, share *models.LinkSharing, c echo.
|
|||||||
token, err := auth.NewLinkShareJWTAuthtoken(share)
|
token, err := auth.NewLinkShareJWTAuthtoken(share)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// We send the string token through the parsing function to get a valid jwt.Token
|
// We send the string token through the parsing function to get a valid jwt.Token
|
||||||
tken, err := jwt.Parse(token, func(t *jwt.Token) (interface{}, error) {
|
tken, err := jwt.Parse(token, func(_ *jwt.Token) (interface{}, error) {
|
||||||
return []byte(config.ServiceJWTSecret.GetString()), nil
|
return []byte(config.ServiceJWTSecret.GetString()), nil
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -50,8 +50,8 @@ func getClient() (*mail.Client, error) {
|
|||||||
opts := []mail.Option{
|
opts := []mail.Option{
|
||||||
mail.WithPort(config.MailerPort.GetInt()),
|
mail.WithPort(config.MailerPort.GetInt()),
|
||||||
mail.WithTLSPolicy(tlsPolicy),
|
mail.WithTLSPolicy(tlsPolicy),
|
||||||
//#nosec G402
|
|
||||||
mail.WithTLSConfig(&tls.Config{
|
mail.WithTLSConfig(&tls.Config{
|
||||||
|
//#nosec G402
|
||||||
InsecureSkipVerify: config.MailerSkipTLSVerify.GetBool(),
|
InsecureSkipVerify: config.MailerSkipTLSVerify.GetBool(),
|
||||||
ServerName: config.MailerHost.GetString(),
|
ServerName: config.MailerHost.GetString(),
|
||||||
}),
|
}),
|
||||||
|
@ -354,9 +354,6 @@ func TestProject_ReadAll(t *testing.T) {
|
|||||||
assert.Len(t, projects, 25)
|
assert.Len(t, projects, 25)
|
||||||
_ = s.Close()
|
_ = s.Close()
|
||||||
})
|
})
|
||||||
t.Run("only child projects for one project", func(t *testing.T) {
|
|
||||||
// TODO
|
|
||||||
})
|
|
||||||
t.Run("all projects for user", func(t *testing.T) {
|
t.Run("all projects for user", func(t *testing.T) {
|
||||||
db.LoadAndAssertFixtures(t)
|
db.LoadAndAssertFixtures(t)
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
|
@ -220,7 +220,7 @@ func HandleCallback(c echo.Context) error {
|
|||||||
log.Errorf("Could not proceed with group routine %v", err)
|
log.Errorf("Could not proceed with group routine %v", err)
|
||||||
}
|
}
|
||||||
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
||||||
err = RemoveUserFromTeamsByIds(s, u, teamIDsToLeave)
|
err = RemoveUserFromTeamsByIDs(s, u, teamIDsToLeave)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Found error while leaving teams %v", err)
|
log.Errorf("Found error while leaving teams %v", err)
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ func RemoveEmptySSOTeams(s *xorm.Session, teamIDs []int64) (errs []error) {
|
|||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveUserFromTeamsByIds(s *xorm.Session, u *user.User, teamIDs []int64) (err error) {
|
func RemoveUserFromTeamsByIDs(s *xorm.Session, u *user.User, teamIDs []int64) (err error) {
|
||||||
|
|
||||||
if len(teamIDs) < 1 {
|
if len(teamIDs) < 1 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -185,7 +185,7 @@ func TestGetOrCreateUser(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = RemoveUserFromTeamsByIds(s, u, teamIDsToLeave)
|
err = RemoveUserFromTeamsByIDs(s, u, teamIDsToLeave)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
errs = RemoveEmptySSOTeams(s, teamIDsToLeave)
|
errs = RemoveEmptySSOTeams(s, teamIDsToLeave)
|
||||||
for _, err = range errs {
|
for _, err = range errs {
|
||||||
@ -226,7 +226,7 @@ func TestGetOrCreateUser(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
teamIDsToLeave := utils.NotIn(oldOidcTeams, oidcTeams)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = RemoveUserFromTeamsByIds(s, u, teamIDsToLeave)
|
err = RemoveUserFromTeamsByIDs(s, u, teamIDsToLeave)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
errs = RemoveEmptySSOTeams(s, teamIDsToLeave)
|
errs = RemoveEmptySSOTeams(s, teamIDsToLeave)
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
|
@ -48,7 +48,7 @@ func SetupTokenMiddleware() echo.MiddlewareFunc {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
ErrorHandler: func(c echo.Context, err error) error {
|
ErrorHandler: func(_ echo.Context, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, "missing, malformed, expired or otherwise invalid token provided").SetInternal(err)
|
return echo.NewHTTPError(http.StatusUnauthorized, "missing, malformed, expired or otherwise invalid token provided").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ func setupMetrics(a *echo.Group) {
|
|||||||
r := a.Group("/metrics")
|
r := a.Group("/metrics")
|
||||||
|
|
||||||
if config.MetricsUsername.GetString() != "" && config.MetricsPassword.GetString() != "" {
|
if config.MetricsUsername.GetString() != "" && config.MetricsPassword.GetString() != "" {
|
||||||
r.Use(middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) {
|
r.Use(middleware.BasicAuth(func(username, password string, _ echo.Context) (bool, error) {
|
||||||
if subtle.ConstantTimeCompare([]byte(username), []byte(config.MetricsUsername.GetString())) == 1 &&
|
if subtle.ConstantTimeCompare([]byte(username), []byte(config.MetricsUsername.GetString())) == 1 &&
|
||||||
subtle.ConstantTimeCompare([]byte(password), []byte(config.MetricsPassword.GetString())) == 1 {
|
subtle.ConstantTimeCompare([]byte(password), []byte(config.MetricsPassword.GetString())) == 1 {
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@ -203,7 +203,7 @@ func RegisterRoutes(e *echo.Echo) {
|
|||||||
|
|
||||||
// API Routes
|
// API Routes
|
||||||
a := e.Group("/api/v1")
|
a := e.Group("/api/v1")
|
||||||
e.OnAddRouteHandler = func(host string, route echo.Route, handler echo.HandlerFunc, middleware []echo.MiddlewareFunc) {
|
e.OnAddRouteHandler = func(_ string, route echo.Route, _ echo.HandlerFunc, _ []echo.MiddlewareFunc) {
|
||||||
models.CollectRoutesForAPITokenUsage(route)
|
models.CollectRoutesForAPITokenUsage(route)
|
||||||
}
|
}
|
||||||
registerAPIRoutes(a)
|
registerAPIRoutes(a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user