Yoast\WP\SEO\MyYoast_Client\User_Interface

Connection_Permission{}Yoast 1.0

Single source of truth for the HTTP-boundary check that gates managing the site's MyYoast connection.

Deliberately a user-interface concern, not an application one: the WP-CLI entry point (wp yoast auth) is trusted by virtue of shell access and runs with no logged-in user, so the capability check must live at the HTTP boundary and never leak into MyYoast_Client or the application layer. Pushing it down would break CLI usage or force a --user= flag on every command.

Хуков нет.

Использование

$Connection_Permission = new Connection_Permission();
// use class methods

Методы

  1. public can_manage()

Код Connection_Permission{} Yoast 28.3

class Connection_Permission {

	/**
	 * The capability required to manage the MyYoast connection over HTTP.
	 *
	 * @var string
	 */
	private const MANAGE_CAPABILITY = 'wpseo_manage_options';

	/**
	 * Whether the current HTTP user may manage the MyYoast connection.
	 *
	 * @return bool
	 */
	public function can_manage(): bool {
		return \current_user_can( self::MANAGE_CAPABILITY );
	}
}