* Tags and files for posts and writtings

* TryAssert(Title ~ H1)
This commit is contained in:
Paul Schneider 2014-09-24 16:19:23 +02:00
commit 07be6f2928
8 changed files with 102 additions and 30 deletions

View file

@ -12,6 +12,19 @@ namespace Yavsc.Controllers
{
public class BlogsApiController : Controller
{
public void Tag (long postid,string tag) {
BlogEntry e = BlogManager.GetPost (postid);
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;
if (rguser != e.UserName) {
throw new AccessViolationException (
string.Format (
"Vous n'avez pas le droit de tagger des billets du Blog de {0}",
e.UserName));
}
}
}
public static HttpStatusCodeResult RemovePost(string user, string title) {
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;

View file

@ -21,13 +21,27 @@ namespace Yavsc.ApiControllers
return WFManager.CreateEstimate (
Membership.GetUser().UserName,title);
}
[HttpGet]
[Authorize]
public void DropWritting(long wrid)
{
WFManager.DropWritting (wrid);
}
[HttpGet]
[Authorize]
public void DropEstimate(long estid)
{
WFManager.DropEstimate (estid);
}
[HttpGet]
[Authorize]
public object Index()
{
return new { test="Hello World" };
// TODO inform user on its roles and alerts
string username = Membership.GetUser ().UserName;
return new { test=string.Format("Hello {0}!",username) };
}
[HttpGet]