Possible bug in application/Espo/Acl/User.php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dimyy
    Active Community Member
    • Jun 2018
    • 569

    Possible bug in application/Espo/Acl/User.php



    Entity has no isPortal(). isPortal() applicable to user.

    Affected to: I try to read note throw API (not admin) user (:
    GET https://espo/api/v1/note/6112956abc970994f

    Result: [2021-08-13 14:10:11] Espo.ERROR: Slim Application Error Type: Error Code: 0 Message: Call to undefined method Espo\Entities\Note::isPortal() File: application/Espo/Acl/User.php Line: 44 Trace: #0 application/Espo/Core/AclManager.php(236): Espo\Acl\User->checkEntityRead(Object(Espo\Entities\User), Object(Espo\Entities\Note), Object(stdClass)) #1 application/Espo/Core/AclManager.php(211): Espo\Core\AclManager->checkEntity(Object(Espo\Entities\User), Object(Espo\Entities\Note), 'read') #2 application/Espo/Core/Acl.php(110): Espo\Core\AclManager->check(Object(Espo\Entities\User), Object(Espo\Entities\Note), 'read') #3 application/Espo/Services/Record.php(416): Espo\Core\Acl->check(Object(Espo\Entities\Note), 'read') #4 application/Espo/Services/Record.php(389): Espo\Services\Record->getEntity('5fae7c4ee3fd7e5...') #5 application/Espo/Core/Controllers/Record.php(67): Espo\Services\Record->read('5fae7c4ee3fd7e5...') #6 application/Espo/Core/ControllerManager.php(109): Espo\Core\Controllers\Record->actionRead(Array, '', Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #7 application/Espo/Core/Api/RouteProcessor.php(84): Espo\Core\ControllerManager->process('Note', 'read', Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #8 application/Espo/Core/ApplicationRunners/Api.php(184): Espo\Core\Api\RouteProcessor->process('/{controller}/{...', Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper)) #9 application/Espo/Core/ApplicationRunners/Api.php(112): Espo\Core\ApplicationRunners\Api->processRequest(Array, Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper), Array) #10 vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(43): Espo\Core\ApplicationRunners\Api->Espo\Core\ApplicationRunners\{closure}(Object(Sli m\Psr7\Request), Object(Slim\Psr7\Response), Array) #11 vendor/slim/slim/Slim/Routing/Route.php(381): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Psr7\Request), Object(Slim\Psr7\Response), Array) #12 vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\Route->handle(Object(Slim\Psr7\Request)) #13 vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #14 vendor/slim/slim/Slim/Routing/Route.php(341): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #15 vendor/slim/slim/Slim/Routing/RouteRunner.php(84): Slim\Routing\Route->run(Object(Slim\Psr7\Request)) #16 vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(60): Slim\Routing\RouteRunner->handle(Object(Slim\Psr7\Request)) #17 vendor/slim/slim/Slim/MiddlewareDispatcher.php(140): Slim\Middleware\RoutingMiddleware->process(Object(Slim\Psr7\Request), Object(Slim\Routing\RouteRunner)) #18 vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(107): class@anonymous->handle(Object(Slim\Psr7\Request)) #19 vendor/slim/slim/Slim/MiddlewareDispatcher.php(140): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Psr7\Request), Object(class@anonymous)) #20 vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle(Object(Slim\Psr7\Request)) #21 vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request)) #22 vendor/slim/slim/Slim/App.php(199): Slim\App->handle(Object(Slim\Psr7\Request)) #23 application/Espo/Core/ApplicationRunners/Api.php(94): Slim\App->run() #24 application/Espo/Core/Application.php(107): Espo\Core\ApplicationRunners\Api->run(NULL) #25 api/v1/index.php(37): Espo\Core\Application->run('Espo\\Core\\Appli...') #26 {main} Tips: To display error details in HTTP response set "displayErrorDetails" to true in the ErrorHandler constructor. [] []
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    It's checking user entity, so $entity->isPortal is legit here. Since PHP does not have generics, we have to use Entity typehint.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • dimyy
      Active Community Member
      • Jun 2018
      • 569

      #3
      Why it try to check note ?

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        I don't know. Please try to debug and help.

        I could not reproduce on v6.1.8.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment


        • dimyy
          dimyy commented
          Editing a comment
          It could only show up in 6.0.8. I tried to reproduce on demo.espocrm.com and failed
      Working...