Jump to content

Recommended Posts

Hi,

 

I need to design a approval workflow for a blog.

 

I have 3 types of users. "Administrators", "Managers" and "Writers".

 

The "Managers" approve "Writers" posts and the "Administrator" approve the "Managers" decisions.

 

How can I design the database to handle this?

 

Best Regards,

André.

 

Link to comment
https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/
Share on other sites

I would do separate table for the user levels and join it with users when needed.

 

table_user_level

----------------

id

user_level (e.g varchar holding "Manager", "Administrator" or "Writer")

 

 

table_users

----------------

user_id

user_level_id

username

nick

etc..

 

And then of course in the blog posts table you would have column called approved (could be boolean). Then in the code you check when user logs in what level he is and what he is approved to do.

Hi,

 

Thanks for your reply.

 

Your design works great with one approval action for each new post. In my case, for each new post, the "Manager" and the "Administrator" must to approve. The "Manager" approve the post of the "Writer" and the "Administrator" approve the decision of the "Manager".

 

Any ideas for handle this?

 

Best Regards,

André.

 

 

Maybe then you should create a link table between approvals and blog posts.

 

approvals

---------

id

admin_approved (bool)

manager_approved (bool)

blog_post_id

 

Then in code you will show for the manager the posts that has not been approved yet by managers, and for the admins you will show the posts that has been approved by managers.

Hi

 

An alternative would be to have the user levels as 1 (writer), 2 (manager) and 4 (administrator).

 

Add this value to the approval column, so that if 1 you know it has been approved by the writer, 3 by the writer and the manager and 7 if by the writer manager and administrator.

 

Effectively the same as using a bit string, with each bit representing a level of approval.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.