Announcement

Collapse
No announcement yet.

Access Control of custom php file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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.

    Comment


    • #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...
    X