BiologicalRecordsCentre / PoMS

repository for Pollinator Monitoring Scheme website
0 stars 0 forks source link

Question: assigning web pages to roles #150

Closed kitenetter closed 1 year ago

kitenetter commented 1 year ago

I could do with setting up a new page on the website that will only be accessible to users with the 1km Square Volunteer role or the UKCEH Staff role (plus the admin role). Can you let me know how this is controlled? (Or if it's easier to set up a blank standard page that I can edit that would also be fine!)

andrewvanbreda commented 1 year ago

Hi @kitenetter We can create a branch new permission for that page which we can assign to those roles. The PoMS site essentially works by having a unique permission for each page that we assign to roles.

However, the trouble is is I don't think permissions can be assigned to a basic Drupal page to limit access. So I think we have 3 options.

  1. If the information on the page isn't sensitive (and it is just for convenience that we don't want people to see it) we can limit the menu option to those roles (but a user would still be able to go to the page if they knew the URL).

  2. We could install a module to allow the permissions to be applied to a basic page. This is perhaps most elegant, but needs more setup.

  3. We could create an Indicia page such as a report page, and leave it blank but fill in the detail on the html intro section at the top. This would work but is bit of a fudge, although it would allow you to put Indicia data grids onto the page at a later stage if needed.

Thoughts on the limitations of these approaches and what might be best for your scenario?

kitenetter commented 1 year ago

Thanks @andrewvanbreda - I think either option 1 or 3 will work for what I need, and I can try those out. Closing.

kitenetter commented 1 year ago

@andrewvanbreda I'm now trying to create an Indicia page, with just some text in the introductory text box, but it won't allow this to be saved:

image

If you're able to create a blank page that I can edit that would be great, but if this is problematic let me know and I'll go back to option 1.

andrewvanbreda commented 1 year ago

@kitenetter https://ukpoms.org.uk/node/66

kitenetter commented 1 year ago

Thanks! Closing.

kitenetter commented 1 year ago

Sorry @andrewvanbreda one more question: I can't see how the menu links are restricted to roles. If I edit a menu item it has a section "Show menu link for specific roles", but the tick boxes are all unticked for all the menu items I've looked at, including those that are restricted to certain roles.

How do I control access to the menu items? Or is it automatic for the Indicia pages?

andrewvanbreda commented 1 year ago

@kitenetter As the page I created was an Indicia page, you don''t need to use the menu restrictions.

  1. Go to the Edit Tab for the page.
  2. Make sure the "View access control" box is ticked
  3. Enter the permission name into the box next to that checkbox and save the page.
  4. Then go to the permissions area of the site, and add that permission to the roles you want it to apply to.

As the whole page will be restricted, the system will know automatically not to put it in the menu. Masquerade as users if you are unsure if it worked and what to see what they see.

kitenetter commented 1 year ago

Thanks again Andy, that's all working. Closing.