Skip to content

Commit

Permalink
Get user roles from loaded user
Browse files Browse the repository at this point in the history
  • Loading branch information
markfullmer committed Oct 4, 2020
1 parent 943cb17 commit b524ad1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Plugin/rest/resource/SubmitIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function post($data) {
return new ResourceResponse($response_status);
}
if (!empty($data['title']) && !empty($data['description'])) {
$roles = $this->currentUser->getRoles();
$user = User::load($this->currentUser->id());
$roles = $user->getRoles();
$name = $user->get('field_full_name');
$name = $name[0]['value'] ?? $this->currentUser->getUsername();
$reported_roles = array_diff($roles, ['authenticated', 'administrator']);
Expand Down

0 comments on commit b524ad1

Please sign in to comment.