Jump to content
Sign in to follow this  
Zeka

Check if user is able to hide/unhide page

Recommended Posts

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? 

Share this post


Link to post
Share on other sites

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 by flydev
doc ref.

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...