throw new InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username));
33
}
34
35
if ($super) {
36
$user->setSuperAdmin(true);
37
$output->writeln(sprintf('User "%s" has been promoted as a super administrator. This change will not apply until the user logs out and back in again.', $username));
38
} else {
39
if ($user->hasRole($role)) {
40
$output->writeln(sprintf('User "%s" did already have "%s" role.', $username, $role));
41
42
return;
43
}
44
45
$user->addRole($role);
46
$output->writeln(sprintf('Role "%s" has been added to user "%s". This change will not apply until the user logs out and back in again.', $role, $username));