| Server IP : 108.167.142.43 / Your IP : 216.73.216.223 Web Server : Apache System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64 User : delarice ( 2406) PHP Version : 8.3.36 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home2/delarice/public_html/wp-content/plugins/templately/modules/mcp-core/Support/ |
Upload File : |
<?php
/**
* Shared permission gate for all Templately MCP abilities (FR-007).
*
* @package Templately\Modules\McpCore\Support
*/
namespace Templately\Modules\McpCore\Support;
class Permissions {
/**
* `manage_options` gate used by every ability's permission_callback,
* including the two read-only discovery/detail abilities.
*
* @return bool
*/
public static function can_use_abilities(): bool {
return is_user_logged_in() && current_user_can( 'manage_options' );
}
/**
* Additional gate for the "existing post" import target (FR-008):
* the acting user must also be able to edit the specific target post.
*
* @param int $post_id
* @return bool
*/
public static function can_edit_post( int $post_id ): bool {
return get_post( $post_id ) instanceof \WP_Post && current_user_can( 'edit_post', $post_id );
}
}