English 中文(简体)
Create, Approve, Edit, Approve pattern for site content
原标题:

I m working on a modification to a site to allowing users to enter content. However, once they ve created that content it needs to be approved before it can be published. This is fairly easy to achieve by having a "moderate" bit set in the record for that content and only one table is needed.

Now I also want to allow users to edit the content much like here on StackOverflow. However, each edit needs to be approved as well as being stored so that a history of edits can be viewed.

It is acceptable to prevent editing to the "live" record while an edit is pending approval so conflict of pending edits is not an issue.

My intention is to keep the collection of previous versions of each item in a separate table and have the pending edit sit in this table until approved/rejected and then if approved swapped with the record in the main table.

Can anyone see any flaws in this pattern? Can you think of a better way to do this?

Although I don t think that it s relevant I m using C# with ASP.NET MVC and SQL Server as the data store.

问题回答

About the only things that springs to my mind is timing.

If the edit is time critical, like a promotion or offer, then the approval process will need to be pretty snappy also.

You may want to consider building in an email function, or priority flag, so that edits can be approved in a timely manner.

One other consideration, and I don t know if time allows for this, is to maybe incorporate Windows Workflow Foundation. You could attach the edit record id to a workflow item that then handles the timeliness of the approval.

It also means that if an approver is away, that someone else could pick it up as it s a workflow item that has a queue and if you are a member of the queue you ll see it.

I know that s a heck of a lot more work but I think a better solution than just relying on someone to come along and approve the change.

What about something like this:

  • One table for the items and one table for all revisions. The revisions have an approved flag.
  • View
    • Users get the latest approved revision.
    • Moderators get the latest revision and the option to approve it.
  • Edit
    • Disabled for users when there is a newer revision than the latest approved revision.
    • Always enabled for moderators.
  • History
    • Shows only approved revisions to users.
    • Shows all revisions to moderators.

It is acceptable to prevent editing to the "live" record while an edit is pending approval so conflict of pending edits is not an issue.

I know a website that does this. I personally find it very annoying. I wish they d do it like this:

  • One table for the items and one table for all revisions. The revisions have an approved flag.
  • View
    • Guests get the latest approved revision.
    • Registered users can choose between the latest and the latest approved revision.
    • Moderators get the latest revision and the option to approve it.
  • Edit
    • Disabled for guests.
    • Users can revise the latest revision (approved or not).
    • Always enabled for moderators.
  • History
    • Shows only approved revisions to guests.
    • Shows all revisions to moderators and registered users.

I have worked with a few of the major commercial CMS, and I don t remember any of their workflows creating a physical copy of the content when it is approved. I can see that it is a tempting idea, though. You want to prevent unapproved content from leaking out into the open, etc, but I don t think there is a good technical reason for doing that (unless you expect so much content that partitioning it into published and unpublished sets has a performance benefit).

I don t think that there is anything particularly wrong with your approach. But you are duplicating data for no good reason.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签