Check user permissions works in plugin but produce error in admin panel

Solution:

please try below approach

<?php

/*
Plugin Name: Check gallery user
Description: Check gallery user
Version: 1.0
*/

function cgu_init() {
    if ( isset( $_GET['cgu_check'] ) && 'check' === $_GET['cgu_check'] ) {
        $manage_options = 'no';
        if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
            $manage_options = 'yes';
        }
        $perms = array( "perms" => array( "perm" => $manage_options ) );
        echo json_encode( $perms );
        die();
    }
}

add_action( 'init', 'cgu_init' );

And then when you send request just send it to http://your-site/?cgu_check=check