Regular User cannot send email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • silgon
    Junior Member
    • Dec 2024
    • 6

    Regular User cannot send email

    I'm not sure if this is an issue, but I've been hitting my head against the wall for several hours. My Admin user can send emails and my Regular users can't.
    I'm really frustrated because I cannot find the root of the problem. I believe that I'm missing something really silly, like some permission I'm not seeing or something.

    The user cannot send either on a personal mail or in a group email. In the group mail configuration for SMTP sharing is allowed.
    Anyway, when I try to send an email I get the following:
    Click image for larger version  Name:	ca64cc6b-e958-43c8-b377-51b183fef373.png Views:	2 Size:	8.2 KB ID:	112904

    Concerning the emails, the user has email enabled. The following is the extract of the user's access as seen by the admin user.
    Click image for larger version  Name:	e581ab53-65d9-48a7-867e-640e2fb49723.png Views:	2 Size:	24.2 KB ID:	112905


    Here is the log file with debug and trace enabled.

    Code:
    [2024-12-06 19:50:39] DEBUG: API (403) Assignment failure: assigned user or team not allowed.; POST /Email; Input data: {"status":"Sending","isRead":true,"isImportant":fa lse,"inTrash":false,"inArchive":false,"folderId":n ull,"isUsers":false,"isHtml":true,"isSystem":false ,"isJustSent":false,"assignedUsersIds":["6750950e4452e02e6"],"assignedUsersNames":{"6750950e4452e02e6":"sil gon Islas"},"from":"some@mail.com","to":"another@gmail .com","cc":"","bcc":"","parentType":null,"parentNa me":null,"parentId":null,"selectTemplateName":null ,"selectTemplateId":null,"subject":"aoehcr","name" :"aoehcr","attachmentsIds":[],"body":"<p>hcr<br></p>","bodyPlain":"hcr\n\n\n"}; Route pattern: /{controller}; Route params: Array
    (
    [controller] => Email
    [action] => create
    )
    [2024-12-06 19:50:39] WARNING: (403) Assignment failure: assigned user or team not allowed. :: POST /Email :: /var/www/html/application/Espo/Core/Record/Service.php(504)
    [object] (Espo\Core\Exceptions\Forbidden(code: 403): Assignment failure: assigned user or team not allowed. at /var/www/html/application/Espo/Core/Record/Service.php:504)
    [stacktrace]
    #0 /var/www/html/application/Espo/Core/Record/Service.php(851): Espo\Core\Record\Service->processAssignmentCheck(Object(Espo\Entities\Email ))
    #1 /var/www/html/application/Espo/Services/Email.php(74): Espo\Core\Record\Service->create(Object(stdClass), Object(Espo\Core\Record\CreateParams))
    #2 /var/www/html/application/Espo/Core/Controllers/RecordBase.php(183): Espo\Services\Email->create(Object(stdClass), Object(Espo\Core\Record\CreateParams))
    #3 /var/www/html/application/Espo/Core/Api/ControllerActionProcessor.php(87): Espo\Core\Controllers\RecordBase->postActionCreate(Object(Espo\Core\Api\RequestWrap per), Object(Espo\Core\Api\ResponseWrapper))
    #4 /var/www/html/application/Espo/Core/Api/ControllerActionHandler.php(65): Espo\Core\Api\ControllerActionProcessor->process('Email', 'create', Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper))
    #5 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Espo\Core\Api\ControllerActionHandler->handle(Object(Slim\Psr7\Request))
    #6 /var/www/html/application/Espo/Core/Api/RouteProcessor.php(222): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))
    #7 /var/www/html/application/Espo/Core/Api/RouteProcessor.php(149): Espo\Core\Api\RouteProcessor->processControllerAction(Object(Espo\Core\Api\Proc essData), Object(Slim\Psr7\Request), Object(Espo\Core\Api\ResponseWrapper))
    #8 /var/www/html/application/Espo/Core/Api/RouteProcessor.php(127): Espo\Core\Api\RouteProcessor->processAfterAuth(Object(Espo\Core\Api\ProcessData ), Object(Slim\Psr7\Request), Object(Espo\Core\Api\ResponseWrapper))
    #9 /var/www/html/application/Espo/Core/Api/RouteProcessor.php(78): Espo\Core\Api\RouteProcessor->processInternal(Object(Espo\Core\Api\ProcessData) , Object(Slim\Psr7\Request), Object(Espo\Core\Api\RequestWrapper), Object(Espo\Core\Api\ResponseWrapper))
    #10 /var/www/html/application/Espo/Core/Api/Starter.php(109): Espo\Core\Api\RouteProcessor->process(Object(Espo\Core\Api\ProcessData), Object(Slim\Psr7\Request), Object(Slim\Psr7\Response))
    #11 /var/www/html/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(38): Espo\Core\Api\Starter->Espo\Core\Api\{closure}(Object(Slim\Psr7\Request) , Object(Slim\Psr7\Response), Array)
    #12 /var/www/html/vendor/slim/slim/Slim/Routing/Route.php(358): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Psr7\Request), Object(Slim\Psr7\Response), Array)
    #13 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Slim\Routing\Route->handle(Object(Slim\Psr7\Request))
    #14 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))
    #15 /var/www/html/vendor/slim/slim/Slim/Routing/Route.php(315): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))
    #16 /var/www/html/vendor/slim/slim/Slim/Routing/RouteRunner.php(68): Slim\Routing\Route->run(Object(Slim\Psr7\Request))
    #17 /var/www/html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(45): Slim\Routing\RouteRunner->handle(Object(Slim\Psr7\Request))
    #18 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(121): Slim\Middleware\RoutingMiddleware->process(Object(Slim\Psr7\Request), Object(Slim\Routing\RouteRunner))
    #19 /var/www/html/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(76): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Slim\Psr7\Request))
    #20 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(121): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Psr7\Request), Object(Psr\Http\Server\RequestHandlerInterface@ano nymous))
    #21 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Slim\Psr7\Request))
    [NODE="22"]Unminify assets or how to recreate t...o.min.js file?[/NODE] /var/www/html/vendor/slim/slim/Slim/App.php(199): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))
    [NODE="23"]Unminify assets or how to recreate t...o.min.js file?[/NODE] /var/www/html/vendor/slim/slim/Slim/App.php(183): Slim\App->handle(Object(Slim\Psr7\Request))
    #24 /var/www/html/application/Espo/Core/Api/Starter.php(76): Slim\App->run()
    [NODE="25"]Unminify assets or how to recreate t...o.min.js file?[/NODE] /var/www/html/application/Espo/Core/ApplicationRunners/Api.php(45): Espo\Core\Api\Starter->start()
    [NODE="26"]how to upgrade ?[/NODE] /var/www/html/application/Espo/Core/Application/RunnerRunner.php(84): Espo\Core\ApplicationRunners\Api->run()
    [NODE="27"]how to upgrade ?[/NODE] /var/www/html/application/Espo/Core/Application.php(78): Espo\Core\Application\RunnerRunner->run('Espo\\Core\\Appli...', NULL)
    #28 /var/www/html/public/api/v1/index.php(35): Espo\Core\Application->run('Espo\\Core\\Appli...')
    #29 {main}
    I'm using the installation of docker compose (based on https://github.com/espocrm/espocrm-i...odes/ssl/nginx)
    Anyway, any shred of light is deeply appreciated. I'll be still debugging and I'll be back if I get the solution (even though it might be a silly one). I believe it has to do with the fact that I'm still getting to know the software.​

    P.S. I've been kindly redirected to this forum by Yurii Kuznietsov in the following url: https://github.com/espocrm/espocrm/issues/3235

    Update: I tried to use an API user and it's the same as the regular user, I get a 403. Thus, email works with admin user, but not with regular user nor API user. Thus, I believe it is role permission inherited from team group. However, I have no idea what to do next. Also, simple logs of what happen in testmail and email for a personal email account as regular user.
    Code:
    [2024-12-06 22:04:21] WARNING: (403) Assignment failure: assigned user or team not allowed. :: POST /Email :: /var/www/html/application/Espo/Core/Record/Service.php(504)
    [2024-12-06 22:07:16] WARNING: (403)  :: POST /Email/sendTest :: /var/www/html/application/Espo/Tools/Email/SendService.php(651)​
    Last edited by silgon; 12-06-2024, 10:45 PM.
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Please check the following.

    When you compose an email as a regular user, click on the modal window header 'Composer Email'. It will bring you to the full form view. Do you have any Teams specified in the right panel?

    Setting 'Assignment Permission' in Roles to a value other than 'no' might solve your problem. But I'd recommend to figure out the root cause first.
    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

    • silgon
      Junior Member
      • Dec 2024
      • 6

      #3
      This is what I see in my compose mail. I do not see a team in the compose mail.
      Click image for larger version

Name:	image.png
Views:	36
Size:	32.5 KB
ID:	112928
      However, I changed Assignment Permission from Team to all, and it worked. I believe that it is not an expected behavior (I might be wrong). But in any case, for the meantime, it is a workaround for my issue. Thanks Yuri!

      Comment

      • yuri
        Member
        • Mar 2014
        • 8453

        #4
        The header with the text 'Compose Email'. If you click it, it will open the full form where you will be able to see more fields. I believe that email is linked to a team that the user is not related to. I don't know why. It could happen if the user has a Default Team that is not one of their team. (e.g. the team was unlinked after the default was set).
        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

        • silgon
          Junior Member
          • Dec 2024
          • 6

          #5
          Oh, I got it, I didn't know the header was clickable. It's true, there is no team by default, and that's the problem. It's weird, because even when the mail is written following a lead which has a team, it does not take it into account. Thus, it does not inherits the parent team. Also, that means that the user always have to go to the full form. :/
          I'm trying to add the team in the compose email to make it a bit easier, but I do not find it in the layout manager.
          Is there a way to add Assignment Permission as a property in the Regular user default role? Thx!
          Last edited by silgon; 12-07-2024, 05:16 PM.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8453

            #6
            By design, Teams are not inherited from a parent record. Teams are pre-filled according the Default Team of the User. It triggered the assignment permission failure maybe because it required that a record that the user creates were related to some of the user's team. Setting the Default Team should have solved the problem. I'll look into deeper when get a chance.
            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

            • silgon
              Junior Member
              • Dec 2024
              • 6

              #7
              Sorry, Actually I was wrong when I tested what you asked me to test, because to do more experiments I modified the user to be admin and I forgot. Unfortunately I realized just now while doing more testing.
              So, what really happens when I click on the header, I get again:
              Click image for larger version  Name:	image.png Views:	0 Size:	7.2 KB ID:	112935
              Thus, I cannot go to the full form and assign a team, because I cannot click the header.
              To further check, I included a team as the default team without success.
              Thus, the workaround that I have is to set assignment permission to all, because when it's set to team it does not work. For completeness, the docker image I used is espocrm/espocrm:8.4.2-fpm .
              Last edited by silgon; 12-08-2024, 07:18 AM.

              Comment

              Working...