Access Control of custom php file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stefan
    Member
    • Jul 2021
    • 57

    Access Control of custom php file

    Hi everyone!

    Is there a possibility to create a php file (for example in public folder) only accessable for logged in users?


    Thanks in advance,
    Stefan
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    Better create an entityPoint.

    custom/Espo/Custom/EntryPoints/MyEntryPoint.php

    Code:
    <?php
    
    namespace Espo\Custom\EntryPoints;
    
    use Espo\Core\EntryPoint\EntryPoint;
    use Espo\Core\Api\Request;
    use Espo\Core\Api\Response;​
    
    class MyEntryPoint implements EntryPoint
    {
        public function run(Request $request, Response $response): void
        {
        }
    }
    Clear cache.

    Then it will accessible only for logged in users by YOUR_URL?entryPoint=myEntryPoint
    Last edited by yuri; 03-28-2024, 05:53 PM.
    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

    • Stefan
      Member
      • Jul 2021
      • 57

      #3
      Thank you very much yuri!

      (p.s.for future reference: there is a little typo: its namespace - without 's')

      Comment


      • yuri
        yuri commented
        Editing a comment
        I fixed the code.
    Working...