adrianmak

How could I assign specific admin page for user role?

Recommended Posts

There is a user role which is used for content editing.

In my local testing, contact form submission result will be stored as page and use admin process to display the result.

Since the admin process all bind to a admin template, if I give rights to a user role, all other admin page will be view by that role. And this is not I wanted to.

How to give access rights for a admin process, in my case, is the form submission result

Editor role access pages only

post-2272-0-15059100-1422404605_thumb.pn

I want the Editor role able to access the form result

post-2272-0-96945200-1422404605_thumb.pn

  • Like 1

Share this post


Link to post
Share on other sites

If you have created your own ProcessModule for this, you can add the “permission” property to its module info. Only users with the set permission will load the module. The admin page will be hidden for everyone else.

You can also set up your module so that it creates the permission on installation, and automatically removes it when it is uninstalled.

  • Like 5

Share this post


Link to post
Share on other sites

If you have created your own ProcessModule for this, you can add the “permission” property to its module info. Only users with the set permission will load the module. The admin page will be hidden for everyone else.

You can also set up your module so that it creates the permission on installation, and automatically removes it when it is uninstalled.

Ya.....just two lines of code and done :P

    public static function getModuleInfo() {
        return array(
            'title' => 'Process Module (basic example)',
            'summary' => 'A very simple process module as an example on how easy they are to create.',
            'version' => 100,
            'href' => '',
            'permission' => 'form-submit-view', /* permission required */
            'permissions' => array(     
                'form-submit-view' => 'Form submission result.'
                )  /* install new permission */
        );
    }

Share this post


Link to post
Share on other sites
Ya.....just two lines of code and done 

Don't you still want to hide the main page tree and redirect them to them to your Form Result Process Module, or did I misunderstand?

Anyway, that is what the module from netcarver, wanze, and kongondo will do - of course you still need to assign the permission to view the page like Jan showed.

Actually,  re-reading your first post now, maybe you didn't want to hide everything else at all - maybe my 3000th post wasn't helpful at all - oh well, can't win them all :)

  • Like 1

Share this post


Link to post
Share on other sites

It's not about winning here ;) Congrats Adrian anyway.

Share this post


Link to post
Share on other sites

Is this all still valid?

Setting permission in the ProcessModule for the custom admin seems to be the cleanest way to make that admin available to a specific role.

But yes, how do you then hide the main page tree for that role? My custom admin will be an alternative to the main page tree edit interface.

Is AdminRestrictPageTree still the (only) way to achieve that? That module is still alpha, getting kinda old, not explicitly compatible with 3.0

Here is another thread about the same issue; how to hide the tree when there is a custom admin for a specific role. That thread fizzled out in 2015.

If you want to create an admin that looks completely different from the standard admin, is it a better approach to use a custom myadmin template?

Share this post


Link to post
Share on other sites

There's also this module: 

I just installed it on a 3.0.86 site - it works as advertised :)

  • Like 1

Share this post


Link to post
Share on other sites

I can't seem to get this setup working. 

I have added permissions to a Process module which lives under Admin and added the permission to the role 'admin'. But the module page is still not visible in the top navigation.


Any thoughts?

Thanks in advance.

Share this post


Link to post
Share on other sites

Apologies for slow response @dragan

I cleared the assets/cache directory and logged out and in but user with role admin cannot see the process page.
The role admin has the required permission assigned to it.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.