Jump to content

Recommended Posts

Posted

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? 

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

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

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.
×
×
  • Create New...