Commit 19c0808
Updated the ajax calls to check if the caller is a legit user (#3647)
Summary:
## Description
Added extra checks to ensure the plugin ajax calls are only made by the admin user.
### Type of change
Please delete options that are not relevant
- Fix (non-breaking change which fixes an issue)
## Checklist
- [x] I have commented my code, particularly in hard-to-understand areas, if any.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).
## Changelog entry
Fix - Updated the ajax calls to ensure caller is legit
Pull Request resolved: #3647
Test Plan:
2 things need to be tested:
- The affected actions ( product sync, coupons sync, shipping profile sync, closing banners ) can be called by an admin user
- The relevant ajax calls cannot be called by a non-admin user:
-- wp_ajax_wc_facebook_opt_out_of_sync
-- wp_ajax_wc_banner_close_action
-- wp_ajax_wc_facebook_sync_all_products
-- wp_ajax_wc_banner_post_update_close_action
-- wp_ajax_wc_banner_post_update__master_sync_off_close_action
-- wp_ajax_wc_facebook_product_set_banner_closed
Reviewed By: rafael-curran
Differential Revision: D83840123
Pulled By: vahidkay-meta
fbshipit-source-id: 4d3cc6510bd9b39c4844e95288d4422cfeca33431 parent f64fbce commit 19c0808
3 files changed
+50
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
144 | | - | |
145 | | - | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| |||
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | | - | |
163 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
180 | | - | |
181 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| |||
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
198 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
199 | 204 | | |
200 | 205 | | |
201 | 206 | | |
| |||
214 | 219 | | |
215 | 220 | | |
216 | 221 | | |
217 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
212 | 215 | | |
213 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
219 | | - | |
220 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
221 | 229 | | |
222 | 230 | | |
223 | 231 | | |
| |||
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
229 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
230 | 241 | | |
231 | 242 | | |
232 | 243 | | |
| |||
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
239 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
240 | 254 | | |
241 | 255 | | |
242 | 256 | | |
| |||
245 | 259 | | |
246 | 260 | | |
247 | 261 | | |
248 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
249 | 266 | | |
250 | 267 | | |
251 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
446 | 457 | | |
447 | 458 | | |
448 | 459 | | |
| |||
0 commit comments