PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.8.0
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.8.0
3.8.0 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 All 112 releases
templately / modules / mcp-core / Support / Permissions.php

Permissions.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 3.8.0, at modules/mcp-core/Support/Permissions.php

33 lines 848 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shared permission gate for all Templately MCP abilities (FR-007).
4 *
5 * @package Templately\Modules\McpCore\Support
6 */
7
8 namespace Templately\Modules\McpCore\Support;
9
10 class Permissions {
11
12 /**
13 * `manage_options` gate used by every ability's permission_callback,
14 * including the two read-only discovery/detail abilities.
15 *
16 * @return bool
17 */
18 public static function can_use_abilities(): bool {
19 return is_user_logged_in() && current_user_can( 'manage_options' );
20 }
21
22 /**
23 * Additional gate for the "existing post" import target (FR-008):
24 * the acting user must also be able to edit the specific target post.
25 *
26 * @param int $post_id
27 * @return bool
28 */
29 public static function can_edit_post( int $post_id ): bool {
30 return get_post( $post_id ) instanceof \WP_Post && current_user_can( 'edit_post', $post_id );
31 }
32 }
33