Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ryios 122 posts 263 karma points
    Jul 16, 2015 @ 18:09
    Ryios
    0

    Property Editor - Update all versions

    I'm building a Knowledge Base that runs on Umbraco. Unlike other KB's this one's editing experience is all on the front end.

    It's built as a plugin and resides entirely inside App_Plugins/XYZKB, uses two custom view engines, one for the front end and back end.

    For content pages it uses some Content Types and Route Hijacking and strongly typed models etc etc.

    The challenge I've been faced with is I need more granual permissions than "Can or Cannot access page".

    The build in member access control only lets you restrict access to a page or block access to a page. It does not let me add custom logic like "Admin, Edit Post, Create Category, etc etc etc".

    As such I create a custom property editor to store a JSON blob about a nodes permissions and configuration data.

    E.g.

    --The root of the kb- { "memberOwner": 1062, "memberLastUpdater": 1062, "administrators": [ 1062, //member 1069 //member ], "viewers": [ 1085 //role ], "contributors": [ 1069 //member ] }

    A category has the same data as does an article.

    I'm designing it so that it inherits down. So if you add an administrator at the root then they are the administrator of everything in the KB Root node.

    At each level though I can break inheritance causing changes to the parent to longer be picked up by the child.

    --Problem--

    cmsPropertyData is versioned. If you update content properties it causes a new version of each property you updated, including my permission configuration.

    Imagine this scenario

    1. I set permissions on the Root Node causing a new version
    2. After wards a site content editor changes the title of a KB article causing a new version.
    3. I update the permissions on that article to break inheritance to prevent people outside of it's viewers group from seeing it.
    4. The site admin decides the old title was best, and rolls back the content type to a previous version

    -boom permissions are broken, people outside the viewers group can see the content again, but I don't know this for say and think I set the permissions.

    Now I could add a custom table to umbraco for tracking nodeId's and permissions for my KB I'm building and those permissions wouldn't be affected by version control...

    However I would much prefer to keep them the way they are, it's elegant and it works really well aside from the version problem.

    Is there a way I can configure a property on a content type to not be versioned? E.g. same value on every version of the Content?

  • Ryios 122 posts 263 karma points
    Jul 16, 2015 @ 18:24
    Ryios
    0

    Looking at the cmsPropertyType table, there is nothing that would indicate versioning can be turned off for a specific property.

    So I think what I'm going to do is place a watch on the save event for my property type.

    Then I'll detect if any changes were made,

    If changes were made I will call an AuhorizedJsonController to sync the new version of the Property Data with all previous versions.

    As versions build up it could get slow, so now I'm seeing if there is a way you can limit how many versions of something build up, but haven't found that yet.

Please Sign in or register to post replies

Write your reply to:

Draft