Search code examples
piranha-cms

Limited edit rights on pages in Piranha.Core


I've found piranha.core cms this week and it looks great and very extendable.

I need CMS in a site that will need user registration for a fundraiser event for a charity. This would be for donators as well as volunteers raising money. But I also want some users to be able to create news post, etc. This project would require volunteers to be able to edit content on a profile page and for dontators to track their donations. I'd like the accounts of my registrants, volunteers and content creators to be the same accounts.

The Piranha.core example uses 'Piranha Identity With Seed', which in turn uses asp.net identity as I've seen in the UserController.

So here's what I'd like to do :

  • Register users,
  • Create a page for a volunteer when a volunteer registers,
  • Assign rights to the volunteer to be able to edit/publish only their own page.

So I think I could register a user using the Asp.net Identity UserManager, copy a template page using the PageEditService, but the question is: can I limit the rights of a user to just being able to edit the user's profile page? (maybe not even all content on the page)

Cheers,

Jurjen


Solution

  • The manager permissions are function based so that user groups can be assigned the rights to perform different actions on different types of entities. There is no support at the moment to limit access to specific pages to specific users.

    My advice is to create the edit view in the front-end application as it is extremely easy to load & update pages with the existing Api, and this will probably give you more freedom in regards to what you want the users to be able to edit on the page.

    For connecting the created pages with their users you could either:

    1. Add a StringField to the PageType containing the user id, or
    2. Add you own database table in your own DbContext connecting the user & page.

    I would also consider using Posts for your volunteers instead of Pages. This way you could use the built in functionality for creating a Volunteer archive where volunteers could be categorized and tagged for easier searching. It will also make sure the sitemap stays uncluttered and focused.

    Best regards