__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace ElementorPro\Core\Security;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Access_Control {
public static function user_can_edit( int $post_id ): bool {
return current_user_can( Capability::EDIT_POST_META, $post_id );
}
public static function user_can_edit_posts(): bool {
return current_user_can( Capability::EDIT_POSTS );
}
public static function user_can_access_private_posts(): bool {
return current_user_can( Capability::READ_PRIVATE_POSTS );
}
/**
* @throws \Exception
*/
public static function verify_post_edit_access( int $post_id ): void {
if ( ! self::user_can_edit( $post_id ) ) {
throw new \Exception( 'You do not have permission to edit this post.' );
}
}
/**
* @throws \Exception
*/
public static function verify_user_editing_capability(): void {
if ( ! self::user_can_edit_posts() ) {
throw new \Exception( 'Access denied: User does not have editing capabilities.' );
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| access-control.php | File | 981 B | 0640 |
|
| capability.php | File | 562 B | 0640 |
|