* stupidtable.js:
* jquery.tablesorter.js: * jquery.tablesorter.min.js: now using "stupid table", that fixes the row additions and deletions * ChooseADate.aspx: Page to choose a date between valid candidates * YavscModel.csproj: * FreeDate.cs: a free date * FrontOfficeApiController.cs: cleanning using clauses * FrontOfficeController.cs: - cleanning using clauses - check user role before editing the model object * GoogleController.cs: view "ChooseADate" in successfull response to "DateQuery" * WorkFlowController.cs: check user's role to drop the estimate. * Estimate.aspx: * now using "stupid table", that fixes the row additions and deletions. * the user interface more intuitive at row deletion * DateQuery.aspx: changed the query parameters * Web.csproj: google date + stupidtable - tablesorter * IContentProvider.cs: cleaned an unused "using" clause * WorkFlowManager.cs: cleanning spaces
This commit is contained in:
parent
a81701008d
commit
e99c03e54a
15 changed files with 286 additions and 1092 deletions
|
|
@ -10,7 +10,6 @@ using System.Web;
|
|||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Yavsc;
|
||||
using System.Web.Security;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Reflection;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using Yavsc.Controllers;
|
|||
using System.Collections.Generic;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using Yavsc;
|
||||
using System.Web.Security;
|
||||
using System.Threading;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
|
|
@ -65,7 +64,7 @@ namespace Yavsc.Controllers
|
|||
public ActionResult Estimate (Estimate model, string submit)
|
||||
{
|
||||
// Obsolete, set in master page
|
||||
ViewData ["WebApiBase"] = "http://" + Request.Url.Authority + "/api";
|
||||
ViewData ["WebApiBase"] = Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative);
|
||||
ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow";
|
||||
if (submit == null) {
|
||||
if (model.Id > 0) {
|
||||
|
|
@ -83,16 +82,17 @@ namespace Yavsc.Controllers
|
|||
throw new UnauthorizedAccessException ("You're not allowed to view this estimate");
|
||||
}
|
||||
} else {
|
||||
string username = HttpContext.User.Identity.Name;
|
||||
string username = Membership.GetUser().UserName;
|
||||
if (username != model.Responsible
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
|
||||
if (model.Id == 0) {
|
||||
model.Responsible = username;
|
||||
ModelState.Clear ();
|
||||
ModelState.Clear ();
|
||||
// TODO better, or ensure that the model state is checked
|
||||
// before insertion
|
||||
}
|
||||
if (ModelState.IsValid) {
|
||||
if (username != model.Responsible
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
|
||||
|
||||
if (model.Id == 0)
|
||||
model = wfmgr.CreateEstimate (
|
||||
username,
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ namespace Yavsc.Controllers
|
|||
return View ("GoogleErrorMessage", ex);
|
||||
}
|
||||
|
||||
return View (res);
|
||||
return View ("ChooseADate",res);
|
||||
}
|
||||
return View (model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,14 @@ namespace Yavsc.ApiControllers
|
|||
[Authorize]
|
||||
public void DropEstimate(long estid)
|
||||
{
|
||||
string username = Membership.GetUser().UserName;
|
||||
Estimate e = wfmgr.GetEstimate (estid);
|
||||
if (e == null)
|
||||
throw new InvalidOperationException("not an estimate id:"+estid);
|
||||
if (username != e.Responsible
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to drop this estimate");
|
||||
|
||||
wfmgr.DropEstimate (estid);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue