Starting to test some controller
* BlogUnitTest.cs: Should test the user registration * NpgsqlBlogProvider.cs: Fixes usage of Npgsql upgrade to latest version * TestAPI.csproj: switch to .Net framework 4.5.1 * AccountController.cs: refactoring password validation * CalendarController.cs: * WorkFlowController.cs: SendActivationMessage became an extension method * style.css: menu items already have a background and color, since they're `<A>` tags * Unregister.aspx: * AccountController.cs: refactoring user registration * BlogsController.cs: Fixes a confusion between Author and reader ... * YavscHelpers.cs: refactoring the password reset * App.master: no more <div class="menuitem">, they're hyperlinks * Login.aspx: * Profile.aspx: refactoring the user registration * BlogEntryCollection.cs: implements a method to filter a given post collection in order to be displayed tu a given user or anonymous
This commit is contained in:
parent
8a2113a69a
commit
303aaa5e1b
19 changed files with 218 additions and 65 deletions
|
|
@ -185,8 +185,8 @@ namespace Yavsc.Controllers
|
|||
ViewData ["Avatar"] = pr.avatar;
|
||||
ViewData ["BlogTitle"] = pr.BlogTitle;
|
||||
MembershipUser u = Membership.GetUser ();
|
||||
if (u != null)
|
||||
ViewData ["Author"] = u.UserName;
|
||||
|
||||
ViewData ["Author"] = bec.Author;
|
||||
if (!pr.BlogVisible) {
|
||||
// only deliver to admins or owner
|
||||
if (u == null)
|
||||
|
|
@ -197,6 +197,13 @@ namespace Yavsc.Controllers
|
|||
return View ("NotAuthorized");
|
||||
}
|
||||
}
|
||||
if (u == null || (u.UserName != bec.Author) && !Roles.IsUserInRole (u.UserName, "Admin")) {
|
||||
// Filer on allowed posts
|
||||
BlogEntryCollection filtered = bec.FilterFor((u == null)?null : u.UserName);
|
||||
UUTBlogEntryCollection nbec = new UUTBlogEntryCollection (bec.Author, bec.Title);
|
||||
nbec.AddRange (filtered);
|
||||
View ("UserPost",nbec);
|
||||
}
|
||||
}
|
||||
return View ("UserPost",bec);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue