From 0c243435dd38d0ee6b7a448d8d920dcd9a14f4a4 Mon Sep 17 00:00:00 2001 From: Duc Nguyen Date: Sun, 2 May 2021 23:08:06 -1000 Subject: [PATCH] Fix bug authorize --- sql/privilege_loader.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql/privilege_loader.go b/sql/privilege_loader.go index e75f30f..19b13dd 100644 --- a/sql/privilege_loader.go +++ b/sql/privilege_loader.go @@ -43,7 +43,9 @@ func (l PrivilegeLoader) Privilege(ctx context.Context, userId string, privilege return actionNone } defer rows.Close() + exist := false for rows.Next() { + exist = true var action int32 er1 := rows.Scan(&action) if er1 != nil { @@ -51,6 +53,9 @@ func (l PrivilegeLoader) Privilege(ctx context.Context, userId string, privilege } permissions = permissions | action } + if !exist { + return actionNone + } if permissions == actionNone { return actionAll }