feat(spot): added tenant select for public key check in ee version
This commit is contained in:
parent
8757178617
commit
99af6ce45f
3 changed files with 7 additions and 2 deletions
|
|
@ -135,8 +135,7 @@ func (k *keysImpl) IsValid(key string) (*auth.User, error) {
|
||||||
// Get user info by userID
|
// Get user info by userID
|
||||||
user := &auth.User{ID: userID, AuthMethod: "public-key"}
|
user := &auth.User{ID: userID, AuthMethod: "public-key"}
|
||||||
// We don't need tenantID here
|
// We don't need tenantID here
|
||||||
sql = `SELECT 1, name, email FROM public.users WHERE user_id = $1 AND deleted_at IS NULL LIMIT 1`
|
if err := k.conn.QueryRow(getUserSQL, userID).Scan(&user.TenantID, &user.Name, &user.Email); err != nil {
|
||||||
if err := k.conn.QueryRow(sql, userID).Scan(&user.TenantID, &user.Name, &user.Email); err != nil {
|
|
||||||
k.log.Error(context.Background(), "failed to get user: %v", err)
|
k.log.Error(context.Background(), "failed to get user: %v", err)
|
||||||
return nil, fmt.Errorf("user not found")
|
return nil, fmt.Errorf("user not found")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
backend/pkg/spot/service/user.go
Normal file
3
backend/pkg/spot/service/user.go
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
var getUserSQL = `SELECT 1, name, email FROM public.users WHERE user_id = $1 AND deleted_at IS NULL LIMIT 1`
|
||||||
3
ee/backend/pkg/spot/service/user.go
Normal file
3
ee/backend/pkg/spot/service/user.go
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
var getUserSQL = `SELECT tenant_id, name, email FROM public.users WHERE user_id = $1 AND deleted_at IS NULL LIMIT 1`
|
||||||
Loading…
Add table
Reference in a new issue