Jump to content

Hide Process Module custom admin pages for certain role


Roope
 Share

Recommended Posts


I have three roles for admin users (admin, sales, billing) and all of them have custom admin process page under /admin/. I'd like to limit page view permisions so that 'sales' couldn't see custom admin page for role 'billing'.


This could be done easily by using diogos Admin Custom Pages Module but it's not compatible with new admin theme and has some another disadvantages compared to straight Process Module approach.

Is there any way to control $page->viewable() per role even if pages share the same template? Thanks for any help!

Link to comment
Share on other sites

I was playing with Ryans Page Edit Per User but totally missed this one.. Thanks kongondo!

Actually this wasn't even needed since now that custom admin pages are process modules, I can create permission for each and use that with role to limit access. Works very nice.

Link to comment
Share on other sites

...Actually this wasn't even needed since now that custom admin pages are process modules, I can create permission for each and use that with role to limit access. Works very nice.

That was my thinking too but wasn't sure what your use case was...Glad you sorted it out..

Link to comment
Share on other sites

Yep, my explanations in finnish are usually terrible and worse at english so it can be hard in both ends  :)
 
Then to another problem with this case. There is 'item' template with no access settings but noticed that when I log in as non superuser it throws me error when creating new page. User can still edit existing page with no problems. Just updated core from dev to 2.4.1 but no change.
 
Permissions for sales role at item page (parent has same):
page-view
page-edit
page-delete
page-move
page-create
page-add
 
Error:
TemplateFile: You don't have access to the template required to add pages here
#0 [internal function]: ProcessPageAdd->___execute()
#1 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array)
#2 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('execute', Array)
#3 /Users/Roope/Sites/demo/wire/core/ProcessController.php(196): Wire->__call('execute', Array)
#4 /Users/Roope/Sites/demo/wire/core/ProcessController.php(196): ProcessPageAdd->execute()
#5 [internal function]: ProcessController->___execute()
#6 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array)
#7 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('execute', Array)
#8 /Users/Roope/Sites/demo/wire/core/admin.php(64): Wire->__call('execute', Array)
#9 /Users/Roope/Sites/demo/wire/core/admin.php(64): ProcessController->execute()
#10 /Users/Roope/Sites/demo/wire/modules/AdminTheme/AdminThemeDefault/controller.php(13): require('/Users/Roope/Si...')
#11 /Users/Roope/Sites/demo/site/templates/admin.php(24): require('/Users/Roope/Si...')
#12 /Users/Roope/Sites/demo/wire/core/TemplateFile.php(140): require('/Users/Roope/Si...')
#13 [internal function]: TemplateFile->___render()
#14 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array)
#15 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('render', Array)
#16 /Users/Roope/Sites/demo/wire/modules/PageRender.module(337): Wire->__call('render', Array)
#17 /Users/Roope/Sites/demo/wire/modules/PageRender.module(337): TemplateFile->render()
#18 [internal function]: PageRender->___renderPage(Object(HookEvent))
#19 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array)
#20 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('renderPage', Array)
#21 /Users/Roope/Sites/demo/wire/core/Wire.php(381): Wire->__call('renderPage', Array)
#22 /Users/Roope/Sites/demo/wire/core/Wire.php(381): PageRender->renderPage(Object(HookEvent))
#23 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('render', Array)
#24 /Users/Roope/Sites/demo/wire/modules/Process/ProcessPageView.module(152): Wire->__call('render', Array)
#25 /Users/Roope/Sites/demo/wire/modules/Process/ProcessPageView.module(152): Page->render()
#26 [internal function]: ProcessPageView->___execute()
#27 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array)
#28 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('execute', Array)
#29 /Users/Roope/Sites/demo/index.php(194): Wire->__call('execute', Array)
#30 /Users/Roope/Sites/demo/index.php(194): ProcessPageView->execute()
#31 {main}

EDIT: I can fix this if I set page permissions manually but when set 'No' only superuser is able to add new 'item' pages.

Edited by Roope
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...