Spica Posted February 23, 2015 Share Posted February 23, 2015 I want to build a rolebased admin page. Actually I use a custom admin page to which the user is redirected after BE login, which is nice so far. So the user is put to something like processwire/page/rolebasedpage with a template myadmin.php. I want now, to replace the pageoutput for processwire/page instead. I tried this in admin.php if($this->user->hasRole("myrole")) { require($config->paths->adminTemplates . 'controller.php'); return $this->page->render("myadmin.php"); } else { require($config->paths->adminTemplates . 'controller.php'); } Is this a good way. And, as it does not work yet, how to do it right. Am I referencing the template uncorrect or is there a more fundamental misconception? Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 23, 2015 Share Posted February 23, 2015 Admin pages are best build as modules, but this will get you started in adding custom php to a backend page http://modules.processwire.com/modules/process-admin-custom-pages/. 1 Link to comment Share on other sites More sharing options...
Spica Posted February 23, 2015 Author Share Posted February 23, 2015 I already do use a custom admin page. May I put my question differently. How to disable the page tab for roles, so that they cannot access the tree list, even not with url manipulation? Link to comment Share on other sites More sharing options...
Spica Posted February 25, 2015 Author Share Posted February 25, 2015 Ok. Maybe I got a bit misled. Was using Admin Custom Pages Process Module. Now building up an own admin module. Link to comment Share on other sites More sharing options...
Soma Posted February 25, 2015 Share Posted February 25, 2015 You add a "permission" to the getModuleInfo array with the permission the user/role needs to have to see the admin page. Link to comment Share on other sites More sharing options...
Spica Posted February 25, 2015 Author Share Posted February 25, 2015 Yes. But this does set global permission to the module. I want a different admin page for different roles, that do not have access to e.g. the tree. I now build a whole admin theme where roles get different outputs, e.g. just get access to own pages. This is the only way I see at the moment. Link to comment Share on other sites More sharing options...
Spica Posted March 10, 2015 Author Share Posted March 10, 2015 Finally I ended up with this two modules: AdminRestrictPageTree ProcessDashboard Link to comment Share on other sites More sharing options...
abhijit Posted June 16, 2015 Share Posted June 16, 2015 I am trying to implement role based page restriction , by installing these two module. AdminRestrictPageTree ProcessDashboard But I am getting redirection problem in every browser. FireFox: "The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. " Chrome: This webpage has a redirect loop Can you Help me with this issue. Link to comment Share on other sites More sharing options...
BillH Posted June 22, 2015 Share Posted June 22, 2015 I had the same thing, and it was a result of permissions not being set properly for the dashboard. On the Settings tab for your Dashboard page, the role (or roles) for your user should appear under "Who can access this page?". If it doesn't, I'm not totally sure which of the following steps fixed it for me, but something worked! First, make sure the "dashboard" permission is selected for the role (the permission should have been created by the module). And of course, check the role is assigned to the relevant users. Then go to the Modules page and click the Refresh button. Then if that doesn't work, you may need to go to the permissions for the Admin template and under Access change "manage view and edit access" to Yes. Then hit Refresh on the modules page again.By the way, a quick look inside the Dashboard module indicates it uses the technique Ryan suggests at https://processwire.com/talk/topic/276-creating-new-admin-page/, which may help with debugging. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now