comparison pkg/auth/opendb.go @ 1327:cabf4789e02b

To make golint happier made context.Context to be the first argument of auth.RunAs.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 25 Nov 2018 15:56:07 +0100
parents a244b18cb916
children a0892b578553
comparison
equal deleted inserted replaced
1326:515815565bd0 1327:cabf4789e02b
124 roles = append(roles, role) 124 roles = append(roles, role)
125 } 125 }
126 return roles, rows.Err() 126 return roles, rows.Err()
127 } 127 }
128 128
129 func RunAs(role string, ctx context.Context, fn func(*sql.Conn) error) error { 129 func RunAs(ctx context.Context, role string, fn func(*sql.Conn) error) error {
130 conn, err := MetamorphConn(ctx, role) 130 conn, err := MetamorphConn(ctx, role)
131 if err != nil { 131 if err != nil {
132 return err 132 return err
133 } 133 }
134 defer conn.Close() 134 defer conn.Close()
142 } 142 }
143 session := Sessions.Session(token) 143 session := Sessions.Session(token)
144 if session == nil { 144 if session == nil {
145 return ErrNotLoggedIn 145 return ErrNotLoggedIn
146 } 146 }
147 return RunAs(session.User, req.Context(), fn) 147 return RunAs(req.Context(), session.User, fn)
148 } 148 }