Skip to content

Commit

Permalink
minor bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdeep committed Jun 7, 2021
1 parent 0de5060 commit 7b6fe12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ func (config *Config) AuthorizeApiKey(apiKey string, accountIDs []string) (autho
// WHERE api_keys.api_key = $1
// AND api_keys.account_id IN UNNEST ($2)
// AND LOWER(roles.service_path) = $3
// AND LOWER(roles.service_method) = $4
// AND UPPER(roles.service_method) = $4
// `

query := psql.Select("account_id").From("api_keys").
Join("roles USING (role_name)").
Where(sq.Eq{"api_key": apiKey}).
Where(sq.Eq{"LOWER(roles.service_path)": config.Service.Path}).
Where(sq.Eq{"LOWER(roles.service_method)": config.Service.Method})
Where(sq.Eq{"UPPER(roles.service_method)": config.Service.Method})

// Find specific account ids when accountIDs present
if len(accountIDs) > 0 {
Expand Down Expand Up @@ -112,7 +112,7 @@ func (config *Config) AuthorizeToken(userEmail string, accountIDs []string) (aut
// WHERE Users.UserEmail = @user_email
// AND Users.AccountId IN UNNEST (@account_ids)
// AND LOWER(Roles.ServicePath) = @service_path
// AND LOWER(Roles.ServiceMethod) = @service_method
// AND UPPER(Roles.ServiceMethod) = @service_method
// `

query := psql.Select("account_id").From("users").
Expand Down

0 comments on commit 7b6fe12

Please sign in to comment.