'edit_posts', 'read_post' => 'read', 'delete_post' => 'delete_posts', 'edit_page' => 'edit_pages', 'delete_page' => 'delete_pages']; return user_can($userId, $primitive[$capability] ?? $capability); } return user_can($userId, $capability, $objectId); } public static function requireTool(array $auth, array $tool, ?int $objectId = null): bool|\WP_Error { if (!self::canUseTool($auth, $tool, $objectId)) { return new \WP_Error('forbidden', __('This connected user or credential cannot use the requested tool.', 'llamly'), ['status' => 403]); } return true; } }