Automattic\WooCommerce\Admin\API
Options::user_has_permission()
Check if the user has permission given an option name.
Метод класса: Options{}
Хуков нет.
Возвращает
true|false
.
Использование
$Options = new Options(); $Options->user_has_permission( $option, $request, $is_update );
- $option(строка) (обязательный)
- Option name.
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
- $is_update(true|false)
- If the request is to update the option.
По умолчанию: false
Код Options::user_has_permission() Options::user has permission WC 9.8.1
public function user_has_permission( $option, $request, $is_update = false ) { $permissions = $this->get_option_permissions( $request ); if ( isset( $permissions[ $option ] ) ) { return $permissions[ $option ]; } // Don't allow to update options in non-production environments if the option is not whitelisted. This is to force developers to update the option permissions when adding new options. if ( 'production' !== wp_get_environment_type() ) { return false; } wc_deprecated_function( 'Automattic\WooCommerce\Admin\API\Options::' . ( $is_update ? 'update_options' : 'get_options' ), '6.3' ); return current_user_can( 'manage_options' ); }