lopes_andre Posted August 19, 2009 Share Posted August 19, 2009 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é. Quote Link to comment https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/ Share on other sites More sharing options...
TeNDoLLA Posted August 19, 2009 Share Posted August 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/#findComment-901882 Share on other sites More sharing options...
lopes_andre Posted August 19, 2009 Author Share Posted August 19, 2009 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é. Quote Link to comment https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/#findComment-901892 Share on other sites More sharing options...
TeNDoLLA Posted August 19, 2009 Share Posted August 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/#findComment-901923 Share on other sites More sharing options...
kickstart Posted August 19, 2009 Share Posted August 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171000-how-to-design-an-approval-worflow/#findComment-901937 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.