Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Console/Commands/Permissions/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function printError($message, $error)
*/
protected function getRole($name, $error = true)
{
$role = $this->roleRepository->findOneBy(['name' => $name]);
$role = $this->roleRepository->findOneByName($name);
if ( ! is_null($role)) {
return $role;
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/HMS/Entities/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function getSentAt(): Carbon
/**
* Sets the value of sentAt.
*
* @param string $sentAt the sent at
* @param Carbon $sentAt the sent at
*
* @return self
*/
Expand Down
2 changes: 1 addition & 1 deletion app/HMS/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getKey()
/**
* Sets the value of firstname.
*
* @param string $name the name
* @param string $firstname the name
*
* @return self
*/
Expand Down
2 changes: 1 addition & 1 deletion app/HMS/Repositories/Doctrine/DoctrineRoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function findAll()
*/
public function findOneByName(string $roleName)
{
return parent::findOneBy(['name' => $roleName]);
return parent::findOneByName($roleName);
}

/**
Expand Down
10 changes: 8 additions & 2 deletions app/HMS/User/Permissions/RoleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ public function addUserToRole(User $user, Role $role)
*/
public function addUserToRoleByName(User $user, string $roleName)
{
$role = $this->roleRepository->findOneByName($roleName);
if ( ! $role = $this->roleRepository->findOneByName($roleName)) {
return;
}

$this->addUserToRole($user, $role);
}

Expand All @@ -130,7 +133,10 @@ public function removeUserFromRole(User $user, Role $role)
*/
public function removeUserFromRoleByName(User $user, string $roleName)
{
$role = $this->roleRepository->findOneByName($roleName);
if ( ! $role = $this->roleRepository->findOneByName($roleName)) {
return;
}

$this->removeUserFromRole($user, $role);
}
}
2 changes: 1 addition & 1 deletion app/Listeners/ViMbAdminSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function onUserAddedToRole(UserAddedToRole $event)
$alias->addForwardAddress($event->user->getEmail());

// save the updated alias back to the external API
$this->client->updateAlias($alias);
$response = $this->client->updateAlias($alias);
if ( ! $response instanceof Link) {
throw new Exception('Alias update failed with Error: '.$response);
}
Expand Down