* Yavsc.sln:

* Web.csproj:
* TestAPI.csproj:
* YavscModel.csproj:
* Automate.cs:
* TaskOutput.cs:
* AssemblyInfo.cs:
* Service.cs:
* FinalStateException.cs:
* FrontOfficeController.cs:
* InvalidLetterException.cs:
* PriceOnItemCount.cs:

* TestAutomate.cs: Tests an Automate

* packages.config: using Machine.Specifications
This commit is contained in:
Paul Schneider
2015-07-17 05:07:05 +02:00
parent 87edbaffe5
commit da90e2cb10
18 changed files with 386 additions and 88 deletions

View File

@ -1,27 +0,0 @@
using System;
using System.ComponentModel;
namespace Yavsc.Admin
{
/// <summary>
/// Task output.
/// </summary>
public class TaskOutput {
/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>The message.</value>
public string Message { get; set; }
/// <summary>
/// Gets or sets the error.
/// </summary>
/// <value>The error.</value>
public string Error { get; set; }
/// <summary>
/// Gets or sets the exit code.
/// </summary>
/// <value>The exit code.</value>
public int ExitCode { get; set; }
}
}

View File

@ -58,6 +58,19 @@ namespace Yavsc.ApiControllers
return CatalogManager.GetCatalog ().GetBrand (brandName).GetProductCategory (prodCategorie);
}
/// <summary>
/// Authorization denied.
/// </summary>
public class AuthorizationDenied : HttpRequestException {
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.ApiControllers.FrontOfficeController+AuthorizationDenied"/> class.
/// </summary>
/// <param name="msg">Message.</param>
public AuthorizationDenied(string msg) : base(msg)
{
}
}
/// <summary>
/// Gets the estimate.
/// </summary>
@ -68,6 +81,14 @@ namespace Yavsc.ApiControllers
public Estimate GetEstimate (long id)
{
Estimate est = wfmgr.ContentProvider.GetEstimate (id);
string username = Membership.GetUser ().UserName;
if (est.Client != username)
if (!Roles.IsUserInRole("Admin"))
if (!Roles.IsUserInRole("FrontOffice"))
throw new AuthorizationDenied (
string.Format (
"Auth denied to eid {1} for:{2}",
id, username));
return est;
}

View File

@ -1,3 +1,8 @@
2015-07-17 Paul Schneider <paul@pschneider.fr>
* Web.csproj:
* FrontOfficeController.cs:
2015-07-15 Paul Schneider <paul@pschneider.fr>
* cldr.js:

View File

@ -155,7 +155,6 @@
<Compile Include="Controllers\BackOfficeController.cs" />
<Compile Include="Admin\Export.cs" />
<Compile Include="Admin\DataManager.cs" />
<Compile Include="Admin\TaskOutput.cs" />
<Compile Include="Controllers\FileSystemController.cs" />
<Compile Include="CatExts\WebCatalogExtensions.cs" />
<Compile Include="Helpers\YavscHelpers.cs" />