Jump to content

PageListerPro Actions and Permissions for Roles


horst
 Share

Recommended Posts

Hi,

I have a setup where a user role has permissions to edit, create, delete, (and add on the parent) as it has permissions to use the lister(s).

I installed page-action-export-csv and gave this permission to a template that is also used in a lister. Now, when I view the lister page with that role, I don't have access to this action. ??

In the Access Tab for that role, this permission is not displayed for selection. What is wrong with my setup?

 

Additionally: Simply trying to add this page-action-export-csv-permission to that role via CLI seems not to work, as it is removed automatically on next page load. Or is my code wrong for that?

$permission = $permissions->get('page-action-export-csv');
$role = $roles->get('myrole');
$role->addPermission($permission);

 

Link to comment
Share on other sites

37 minutes ago, horst said:

I installed page-action-export-csv and gave this permission to a template that is also used in a lister.

Not totally sure about this, but I think for Lister actions you can't selectively enable them for some templates and not others (or rather you can but it doesn't have any restricting effect). That's because the actions apply to all the pages shown in the Lister which could use any template. So you would either enable it for all templates or no templates by editing the role:

2019-01-04_122138.png.03ff5bf912f8470b968dbdc54804ab1f.png

And did you do the step of allowing the action for the Lister instance?

2019-01-04_121612.png.b7628b45a5541c3ce7578c23eb1b35b9.png

 

42 minutes ago, horst said:

Additionally: Simply trying to add this page-action-export-csv-permission to that role via CLI seems not to work, as it is removed automatically on next page load. Or is my code wrong for that?


$permission = $permissions->get('page-action-export-csv');
$role = $roles->get('myrole');
$role->addPermission($permission);

 

You'd need to also save the role:

$role->save();

But maybe you already did that?

  • Like 1
Link to comment
Share on other sites

Thanks @Robin S,

now, after enabling a globally template edit permission for the role, I have the action displayed in the lister and can execute it with this roles users.

And now, I can revoke it for all other templates but the one I want it to have, and its working too.

<confused>Why isn't it working the other way round: don't add globally edit permission on all templates, but only the one I want it to have?</confused>

Link to comment
Share on other sites

9 hours ago, horst said:

And now, I can revoke it for all other templates but the one I want it to have, and its working too.

Are you sure that revoking the permissions for other templates has an effect? I can't reproduce that at my end - it's all or nothing for the Export CSV action. In other words, if I revoke the permission from the basic_page template for a role and then list some basic_page pages in Lister then a user with that role can still export the CSV of those pages. So that makes me think Lister actions are an all templates or no templates affair.

Ryan could probably clarify this in the Lister Pro subforum but I no longer have access to that (expired subscription).

Link to comment
Share on other sites

I will look more closely into it later, as I have a bit pressure atm. In the current project there only is one template in use for csv export and I haven't tested further. Only unchecked other templates for that user in the roles access tab.

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