Ruby: Routing.qll - rename method as httpMethod

This commit is contained in:
Alex Ford
2024-05-31 14:38:26 +01:00
parent af9ed21c36
commit 25f9449f53

View File

@@ -824,58 +824,58 @@ module Routing {
}
/**
* Holds if the (resource, method, path, action) combination would be generated by a call to `resources :<resource>`.
* Holds if the (resource, httpMethod, path, action) combination would be generated by a call to `resources :<resource>`.
*/
bindingset[resource]
private predicate isDefaultResourceRoute(
string resource, string method, string path, string action
string resource, string httpMethod, string path, string action
) {
action = "create" and
(method = "post" and path = "/" + resource)
(httpMethod = "post" and path = "/" + resource)
or
action = "index" and
(method = "get" and path = "/" + resource)
(httpMethod = "get" and path = "/" + resource)
or
action = "new" and
(method = "get" and path = "/" + resource + "/new")
(httpMethod = "get" and path = "/" + resource + "/new")
or
action = "edit" and
(method = "get" and path = "/" + resource + ":id/edit")
(httpMethod = "get" and path = "/" + resource + ":id/edit")
or
action = "show" and
(method = "get" and path = "/" + resource + "/:id")
(httpMethod = "get" and path = "/" + resource + "/:id")
or
action = "update" and
(method in ["put", "patch"] and path = "/" + resource + "/:id")
(httpMethod in ["put", "patch"] and path = "/" + resource + "/:id")
or
action = "destroy" and
(method = "delete" and path = "/" + resource + "/:id")
(httpMethod = "delete" and path = "/" + resource + "/:id")
}
/**
* Holds if the (resource, method, path, action) combination would be generated by a call to `resource :<resource>`.
* Holds if the (resource, httpMethod, path, action) combination would be generated by a call to `resource :<resource>`.
*/
bindingset[resource]
private predicate isDefaultSingularResourceRoute(
string resource, string method, string path, string action
string resource, string httpMethod, string path, string action
) {
action = "create" and
(method = "post" and path = "/" + resource)
(httpMethod = "post" and path = "/" + resource)
or
action = "new" and
(method = "get" and path = "/" + resource + "/new")
(httpMethod = "get" and path = "/" + resource + "/new")
or
action = "edit" and
(method = "get" and path = "/" + resource + "/edit")
(httpMethod = "get" and path = "/" + resource + "/edit")
or
action = "show" and
(method = "get" and path = "/" + resource)
(httpMethod = "get" and path = "/" + resource)
or
action = "update" and
(method in ["put", "patch"] and path = "/" + resource)
(httpMethod in ["put", "patch"] and path = "/" + resource)
or
action = "destroy" and
(method = "delete" and path = "/" + resource)
(httpMethod = "delete" and path = "/" + resource)
}
/**