@@ -129,14 +129,14 @@ func respondError(logger log.Logger, w http.ResponseWriter, msg string) {
129
129
func (r * Ruler ) rules (w http.ResponseWriter , req * http.Request ) {
130
130
logger := util .WithContext (req .Context (), util .Logger )
131
131
userID , ctx , err := user .ExtractOrgIDFromHTTPRequest (req )
132
- if err != nil {
132
+ if err != nil || userID == "" {
133
133
level .Error (logger ).Log ("msg" , "error extracting org id from context" , "err" , err )
134
134
respondError (logger , w , "no valid org id found" )
135
135
return
136
136
}
137
137
138
138
w .Header ().Set ("Content-Type" , "application/json" )
139
- rgs , err := r .GetRules (ctx , userID )
139
+ rgs , err := r .GetRules (ctx )
140
140
141
141
if err != nil {
142
142
respondError (logger , w , err .Error ())
@@ -221,14 +221,14 @@ func (r *Ruler) rules(w http.ResponseWriter, req *http.Request) {
221
221
func (r * Ruler ) alerts (w http.ResponseWriter , req * http.Request ) {
222
222
logger := util .WithContext (req .Context (), util .Logger )
223
223
userID , ctx , err := user .ExtractOrgIDFromHTTPRequest (req )
224
- if err != nil {
224
+ if err != nil || userID == "" {
225
225
level .Error (logger ).Log ("msg" , "error extracting org id from context" , "err" , err )
226
226
respondError (logger , w , "no valid org id found" )
227
227
return
228
228
}
229
229
230
230
w .Header ().Set ("Content-Type" , "application/json" )
231
- rgs , err := r .GetRules (ctx , userID )
231
+ rgs , err := r .GetRules (ctx )
232
232
233
233
if err != nil {
234
234
respondError (logger , w , err .Error ())
0 commit comments