Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthorized pages can be listed by other plugins #10

Closed
nliautaud opened this issue Sep 15, 2017 · 2 comments
Closed

Unauthorized pages can be listed by other plugins #10

nliautaud opened this issue Sep 15, 2017 · 2 comments
Labels

Comments

@nliautaud
Copy link
Owner

nliautaud commented Sep 15, 2017

For now unauthorized pages are still accessible by other plugins, even if they are removed from $pages.
In Pico 0.x I think I was loading this plugin first to avoid this issue, by underscoring its name.

What would be the correct way to hide these pages from other plugins in Pico 1.x ? A way to modify $pages first ? Maybe @PhrozenByte or @smcdougall ?

Related to #9.

@nliautaud nliautaud added the bug label Sep 15, 2017
@PhrozenByte
Copy link

PhrozenByte commented Sep 15, 2017

In Pico 0.x I think I was loading this plugin first to avoid this issue

Yes, execution order matters. You can add a numeric prefix to the PicoUsers directory, telling Pico to load it before any non-prefixed plugin (what should be the default). However, only plugins that really depend on being executed before certain other plugins should be prefixed. Plugins that manipulate the $pages array should be prefixed with a number between 40 and 59. It's not recommended to use the min/max values of the given range, so 45 is probably a good choice for what you're doing (i.e. 45-PicoUsers/).

Please refer to the class docs of Pico::loadPlugins() for more info:

    /**
     * Loads plugins from Pico::$pluginsDir in alphabetical order
     *
     * Plugin files MAY be prefixed by a number (e.g. 00-PicoDeprecated.php)
     * to indicate their processing order. Plugins without a prefix will be
     * loaded last. If you want to use a prefix, you MUST consider the
     * following directives:
     * - 00 to 19: Reserved
     * - 20 to 39: Low level code helper plugins
     * - 40 to 59: Plugins manipulating routing or the pages array
     * - 60 to 79: Plugins hooking into template or markdown parsing
     * - 80 to 99: Plugins using the `onPageRendered` event
     *
     * @see    Pico::getPlugin()
     * @see    Pico::getPlugins()
     * @return void
     * @throws RuntimeException thrown when a plugin couldn't be loaded
     */
    protected function loadPlugins()
    {
        // ...
    }

@nliautaud
Copy link
Owner Author

Thanks, I missed that. That's fixed !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants