Problem/Motivation

when I added user role which has ability to create new accounts nad I have created one everything works fine, however once I logged out and tried to log in with the same account following issues , hence I cannot login at all :/

The website encountered an unexpected error. Please try again later.

Error: Call to a member function getRoles() on null in Drupal\role_hierarchy\Service\RoleHierarchyHelper->actionPluginAccess() (line 230 of modules/contrib/role_hierarchy/src/Service/RoleHierarchyHelper.php).
Drupal\role_hierarchy\Plugin\Action\RoleHierarchyRemoveRoleUser->access() (Line: 99)
Drupal\eca\Entity\Objects\EcaAction->execute() (Line: 188)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 190)
Drupal\eca\Processor->executeSuccessors() (Line: 146)
Drupal\eca\Processor->execute() (Line: 76)
Drupal\eca\EventSubscriber\EcaBase->onEvent()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 73)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() (Line: 25)
Drupal\eca_user\HookHandler->login() (Line: 26)
eca_user_user_login()
call_user_func_array() (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 470)
user_login_finalize() (Line: 163)
Drupal\user\Form\UserLoginForm->submitForm()
call_user_func_array() (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)
CommentFileSizeAuthor
#4 3377062-4.patch687 bytesdineshkumarbollu

Comments

coaston created an issue. See original summary.

mukhtarm’s picture

Hi @coaston I was not reproduce this issue. Can you please explain how can this produced in detail?

What i was tried:
1) installed and enabled role_hierarchy: ^3.4 module
2) Created a new user role (that have lesser permissions than admin) and checked `Strict hierarchy check`
3) Logged in as the newly created user/ adminstrator, and it didn't throwed any errors.

FYI: am using D10.1.1 and PHP 8.2.8

coaston’s picture

Hi MukhtarM,

Newly created user can login, however the user which created him and has specific role which has ability to create users is no longer able to login.

dineshkumarbollu’s picture

Status: Active » Needs review
StatusFileSize
new687 bytes

Hi @coaston

If issue is still i added patch please review.Thanks

  • stefan.butura committed 52dbde3c on 8.x-3.x
    Issue #3377062 by dineshkumarbollu, coaston, mukhtarm:  Call to a member...
stefan.butura’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

alexgreyhead’s picture

Title: Call to a member function getRoles( » Error: Call to a member function getWeight on null in Drupal\role_hierarchy\Service\RoleHierarchyHelper getRoleWeight() (line 129 of RoleHierarchyHelper.php

Updating issue title for search-engine friendliness; current title isn't picked up in a Google search - hopefully the updated title will help future developers find this issue more quickly :-)

/A