Function not working inside of a function in functions.php

Remove the function inside the function, and instead call the wp_register_script and register_block_type inside the large function.

Finally, remove the inner add_action() call, so you only have the ending one for the large function.

function irm_lockdown_author_role() {

if (isset($userrole->roles[0])) {
    $current_role = $userrole->roles[0];
} else {
    $current_role="no_role";
}

if ('author' == $current_role) {

        /* function irm_gutenberg_register_files() { */
            wp_register_script(
                'cc-block-script',
                get_stylesheet_directory_uri() . '/functions.js', // adjust the path to the JS file
                array('wp-blocks', 'wp-edit-post')
            );

            // register block editor script
            register_block_type('cc/ma-block-files', array(
                'editor_script' => 'cc-block-script'
            ));
        /* }
        add_action('init', 'irm_gutenberg_register_files'); */

    }
}

add_action('init', 'irm_lockdown_author_role');