throw new InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username));
32
}
33
34
if ($super) {
35
$user->setSuperAdmin(true);
36
$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));
37
} else {
38
if ($user->hasRole($role)) {
39
$output->writeln(sprintf('User "%s" did already have "%s" role.', $username, $role));
40
41
return;
42
}
43
44
$user->addRole($role);
45
$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));