grrr-amsterdam / wordpress-scaffold

The scaffold for GRRR's WordPress Pro setup.
MIT License
18 stars 3 forks source link

Disable REST API by default for non-authenticated users #26

Closed schoenkaft closed 5 years ago

schoenkaft commented 5 years ago

This is mainly because exposing (admin) users could subject them to personalised hacks. Plus to prevent accidental exposure of sensitive post types or fields (although that would require additional work to do so).

schoenkaft commented 5 years ago

@HammenWS update:

PS: did not update the wiki, since the article about REST routes is still to be written. Plus adding a route this way just works, no need to worry about the security part.

schoenkaft commented 5 years ago

The class now returns:

Routes::NAMESPACE;
// grrr/v1

Routes::get('newsletter');
// newsletter/subscribe

Routes::get_all();
// [ '/grrr/v1/newsletter/subscribe' ]

Routes::get_all(false);
// [ 'newsletter/subscribe' ]

Routes::url('newsletter');
// http://localhost.wordpress-scaffold.nl/wp-json/newsletter/subscribe