You can find the documentation for Updating Plugins for Craft 4 here. In there, there is a section on how user permissions have changed:
Registering permissions has changed slightly in Craft 4: the RegisterUserPermissionsEvent()’s permissions array now requires individual items with heading and permissions keys
use yii\base\Event;
use craft\events\RegisterUserPermissionsEvent;
use craft\services\UserPermissions;
After upgrading to Craft v4, we have consistently been getting the following error when trying to access "My Account" within the Control Panel.
You can find the documentation for Updating Plugins for Craft 4 here. In there, there is a section on how user permissions have changed:
// Craft 3 Event::on( UserPermissions::class, UserPermissions::EVENT_REGISTER_PERMISSIONS, function(RegisterUserPermissionsEvent $event) { $event->permissions['My Heading'] = $permissions; } );
// Craft 4 Event::on( UserPermissions::class, UserPermissions::EVENT_REGISTER_PERMISSIONS, function(RegisterUserPermissionsEvent $event) { $event->permissions[] = [ 'heading' => 'My Heading', 'permissions' => $permissions, ]; } );