File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,21 @@ import (
1212
1313func (s * Server ) handleListWallets (w http.ResponseWriter , r * http.Request ) {
1414 orgID := getOrgID (r .Context ())
15+ userID := getUserID (r .Context ())
1516 vaultID := urlParam (r , "id" )
1617
17- wallets , err := orm.TypedQuery [db.Wallet ](s .db .ORM ).
18+ q := orm.TypedQuery [db.Wallet ](s .db .ORM ).
1819 Filter ("vaultId=" , vaultID ).
1920 Filter ("orgId=" , orgID ).
20- Order ("-createdAt" ).
21- GetAll (r .Context ())
21+ Order ("-createdAt" )
22+
23+ // Per-user isolation: non-admin users only see their own wallets
24+ role := getRole (r .Context ())
25+ if role != "owner" && role != "admin" && userID != "" {
26+ q = q .Filter ("createdBy=" , userID )
27+ }
28+
29+ wallets , err := q .GetAll (r .Context ())
2230 if err != nil {
2331 writeError (w , http .StatusInternalServerError , "database error" )
2432 return
You can’t perform that action at this time.
0 commit comments