Jophie,
You may need to clarify - I am presuming when you say "viewers only can read 1/2 of total articles" you do not actually mean a they always view 50% of articles present?
If you mean what I think you mean - you wish to be able to restrict access to certain articles based on the users role (user, editor, admin etc.)
If you have the book then it does contain all of the logic required to implement such a security model.
Note this is just one way of doing it:
Look at your current articles table. You have a field named OnlyForMembers. This allows you to restrict access to an article to only logged in (registered users).
If you look at the Page_Load event of ShowArticle.aspx (note mine is in
vb.net):
Code:
' if the article has the OnlyForMemebers = true, and the current user
' is anonymous, redirect to the login page
If article.OnlyForMembers AndAlso Not Me.User.Identity.IsAuthenticated Then
Me.RequestLogin()
End If
you can see that if the OnlyForMembers value is checked and if the user is not authenticated, they are redirected to the log in page.
You could extend this further by adding additional fields to your articles table for each role (only really a good idea if you know that you will have a fixed number of roles (i.e. user, editor, admin etc.). Of course this does that you are denormalising your table to some extent but if using the same boolean (checkbox) datatype for these fields, the implications should not be so serious.
So lets imagine you have created an article that can be viewed by Admin (ShowAdmin=True), Editors (ShowEditor=True) but not by normal users (ShowUser=False).
As long as you make the necessary changes to the methods and properties of the articles classes you could do a similar check to the article above although this time instead of checking if a user is logged in, you check if they are logged in and their role. So if Joe Bloggs logs in and he is a member of the users group, your logic will see that ShowAdmin = True (is user a member of the Admin role - NO), ShowEditor = True (is user in the Editor role - NO), ShowUser = False (is user in the Users role - YES)
So essentially if you do not get a match (like in this case): Me.RequestLogin()
I hope that gives you enough information. One of the best things about the book is to learn how to develop a fully featured application properly. If something similar already exists in the application you should be able to copy/adapt accordingly.