PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.7.3
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.7.3
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/API/Dependencies.php +12 -4 3.6.23.7.3 View file →
@@ -25,13 +25,21 @@
25 25 }
26 26
27 27 public function permission_check( WP_REST_Request $request ) {
28 28 $this->request = $request;
29 - // $_route = $request->get_route();
30 29
31 - // if( $_route === '/templately/v1/dependencies/install' && ! Helper::current_user_can( 'install_plugins' ) ) {
32 - // return Helper::error('invalid_permission', __( 'Sorry, you do not have permission to install a plugin.', 'templately' ), 'dependencies/install', 403 );
33 - // }
30 + // Installing reaches beyond template content, so it does not ride the
31 + // `delete_posts` base gate the read routes are happy with. Installer::install()
32 + // checks `install_plugins` / `activate_plugins` per plugin as well; this is the
33 + // front gate, so the route cannot be probed at all without the capability.
34 + if ( $request->get_route() === '/templately/v1/dependencies/install' && ! Helper::current_user_can( 'install_plugins' ) ) {
35 + return $this->error(
36 + 'invalid_permission',
37 + __( 'Sorry, you do not have permission to install a plugin.', 'templately' ),
38 + 'dependencies/install',
39 + rest_authorization_required_code()
40 + );
41 + }
34 42
35 43 return true;
36 44 }
37 45