Jump to content

fields permission


adrianmak
 Share

Recommended Posts

I have a site setting page. This page can be edit by a role named "content editor"

The setting page has some basic fields like site name, meta keywords and description.

There are some other fields like GA code and paypal api access information

I want these fields keep away from a content editor role. Only the super admin could able to edit.

How could i do that?

 

I'm using pw 2.7.3

Link to comment
Share on other sites

If you look at the API Cheatsheet, there's a section for $user.

It has several properties of interest to you situation.

You should have a look at these and check for user permissions and hide / show those sensitive fields accordingly.

$user->rolesGet roles this user has. Returns PageArray. more

$user->hasRole($role)Does the user have the given role? Returns true or false.more

$user->hasPermission($permission)Does the user have the given permission? Returns true or false. more

$user->hasPermission($permission, $page)Does the user have the given permission name on $page? Returns true or false. more

 

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