Jump to content

Set permissions of page created automatically by module


Recommended Posts

Hi All,

I developed a module for ProcessWire for a project I've been working on for a School's Football Association. It's a website for them to list all of the competitions, rounds, fixtures and results etc. All of these are separated into yearly seasons, and each season is to contain a standard page structure, which the module creates. This module creates a page in the Admin for the seasons to be added from. Now, that's fine, it works, but now we're creating the client accounts with minimal permissions, it seems that only super users can access the page that was created by the module upon install.

This page is created from the module's info array, like so:

public static function getModuleInfo() {
    return [
        ...
    
        'page' => [
            'name' => 'season',
            'title' => 'Add Season',
            'permission' => 'season-add' // This did not work
        ]
    
        ...
    ];
}

What I'd like to know, is how I can set the permissions for that page, and allow non-super users to see it in the admin nav and access the page. The page created is of the template 'admin', which I tried applying permissions to for the role created by the module, but that also did not work.

The method I tried on the line with the "this did not work" comment was from the comments in the code in /wire/core/Process.php.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...