@@ -226,6 +226,7 @@ def graphql_pending_query(query)
226226
227227 send :put , "/entitlements-app-acceptance/orgs/:role" do
228228 org_dir = File . join ( BASE_DIR , "org" , params [ "role" ] )
229+ request . body . rewind
229230 postdata = JSON . parse ( request . body . read )
230231 Dir . glob ( File . join ( org_dir , "*" ) ) . each { |filename | FileUtils . rm_f ( filename ) }
231232 postdata [ "users" ] . each { |user | File . open ( File . join ( org_dir , user ) , "w" ) { |f | f . puts Time . now . to_s } }
@@ -234,6 +235,7 @@ def graphql_pending_query(query)
234235
235236 send :put , "/entitlements-app-acceptance/pending" do
236237 pending_dir = File . join ( BASE_DIR , "pending" )
238+ request . body . rewind
237239 postdata = JSON . parse ( request . body . read )
238240 Dir . glob ( File . join ( pending_dir , "*" ) ) . each { |filename | FileUtils . rm_f ( filename ) }
239241 postdata [ "users" ] . each { |user | File . open ( File . join ( pending_dir , user ) , "w" ) { |f | f . puts Time . now . to_s } }
@@ -258,6 +260,7 @@ def graphql_pending_query(query)
258260 end
259261
260262 send :post , "/graphql" do
263+ request . body . rewind
261264 postdata = JSON . parse ( request . body . read )
262265 query = postdata [ "query" ]
263266
@@ -296,6 +299,8 @@ def graphql_pending_query(query)
296299 # Check for case sensitivity concerns
297300 halt 400 unless params [ "username" ] == params [ "username" ] . downcase
298301
302+ # Pull out the role from the request body, halt if not provided.
303+ request . body . rewind
299304 postdata = JSON . parse ( request . body . read )
300305 halt 400 unless %[admin member] . include? ( postdata [ "role" ] )
301306
0 commit comments