Hi
Since i am creating the user on fly if the user doesn’t exist.
But I will have to update the role too on fly if the user exist.
Please file below code for the same
if($account === null){
$account = $this->accountFactory->createAccountWithPassword($accountIdentifier, $password, $groups, 'Neos.Neos:Backend');
$this->partyService->assignAccountToParty($account, $user);
$account->setExpirationDate(new \DateTime('+1 week'));
$this->accountRepository->add($account);
}else{
//TODO here i need to write the code
}