Zeka Posted May 16, 2019 Share Posted May 16, 2019 Hi. I'm building custom UI for editors and I need to check if a user is able to hide and unhide pages (page-hide permission). I thought that $page->listable(); is intended to check this, but it returns true whether a user has page-hide permission or not. So what is the right way to check it? Link to comment Share on other sites More sharing options...
flydev Posted May 16, 2019 Share Posted May 16, 2019 (edited) Why not simply checking if the user has this permission (after installation) with hasPermission() ? What say the doc : Quote Add this permission to your system if you'd like the ability to control whether a given role can hide/unhide a page or not. Without this permission, any user with edit access can hide or unhide a page. When the permission is installed, a user will have to have the permission before they will be able to hide or unhide a page they already have edit access to. Edited May 16, 2019 by flydev doc ref. Link to comment Share on other sites More sharing options...
Zeka Posted May 16, 2019 Author Share Posted May 16, 2019 @flydev Yes, of course, I can use hasPermission, but I thought that if we have $page->publishable(), $page->deleteable() ( these checks also relies on page-publish and page-delete permissions along with other factors), we should have separate method for hide/unhide. Link to comment Share on other sites More sharing options...
dragan Posted May 16, 2019 Share Posted May 16, 2019 Seems like you have to install this permission first: https://processwire.com/blog/posts/processwire-2.6.15-makes-the-permissions-system-a-whole-lot-better/ (it's optional). https://processwire.com/docs/user-access/permissions/#page-hide It's under site.com/backend/access/permissions/add/ -> show system permissions 2 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