FortAwesome / wordpress-fontawesome

Font Awesome Official WordPress Plugin
Other
56 stars 19 forks source link

Selectively register REST API #98

Closed mlwilkerson closed 3 years ago

mlwilkerson commented 3 years ago

The main entry point for page loads invokes initialize_rest_api().

But most REST API endpoints are only valid for admin scenarios.

Can we just avoid registering these routes unless we're being loaded in admin mode?

One that we may need to still load would be the FontAwesome_Conflict_Detection_Controller, when fa()->detecting_conflicts() is true, because that's needed for the conflict scanner to report its results.

mlwilkerson commented 3 years ago

This doesn't seem necessary since the REST API controllers already have permissions checks, which are the same as the checks that would be done in order to determine whether to register the route. Seems like it's pretty well locked down already.