Skip to content

Commit

Permalink
Merge pull request #5 from ucdavis/Prototype
Browse files Browse the repository at this point in the history
CMS
  • Loading branch information
danransom authored Aug 30, 2023
2 parents 130e781 + 47ecde9 commit ca57771
Show file tree
Hide file tree
Showing 506 changed files with 60,749 additions and 50,877 deletions.
8 changes: 4 additions & 4 deletions test/RAPS/RolesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ public async void ReturnRoles()

rapsContext.Setup(c => c.TblRoles).Returns(mockSet.Object);

var mockUser = new Mock<IUserWrapper>();
mockUser.As<IUserWrapper>()
var mockUser = new Mock<UserHelper>();
mockUser.As<IUserHelper>()
.Setup(m => m.GetCurrentUser())
.Returns(new AaudUser());
mockUser.As<IUserWrapper>()
mockUser.As<IUserHelper>()
.Setup(m => m.HasPermission(rapsContext.Object, It.IsAny<AaudUser>(), It.IsAny<string>()))
.Returns(true);

Expand All @@ -164,7 +164,7 @@ public async void ReturnRoles()
.Returns(new List<int> { 1, 2 });

var rolesController = new RolesController(rapsContext.Object);
rolesController.UserWrapper = mockUser.Object;
rolesController.UserHelper = mockUser.Object;
rolesController.SecurityService = mockSecurity.Object;

// act
Expand Down
20 changes: 10 additions & 10 deletions test/Viper.test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="EntityFrameworkCore.Testing.Moq" Version="5.0.0" />
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PackageReference Include="JunitXml.TestLogger" Version="3.0.134" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
34 changes: 34 additions & 0 deletions web/Areas/CMS/Controllers/CMSController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Mvc;
using Viper.Classes.SQLContext;

namespace Viper.Areas.CMS.Controllers
{
[Route("/CMS/[action]")]
public class CMSController : Controller
{
private readonly VIPERContext _viperContext;
private readonly RAPSContext _rapsContext;

public CMSController(RAPSContext rapsContext, VIPERContext viperContext)
{
_rapsContext = rapsContext;
_viperContext = viperContext;
}

[HttpGet]
public IActionResult Files(string id = "", string fn = "", string oldURL = "", string ids = "", string fileName = "")
{
Data.CMS cms = new(_viperContext, _rapsContext);

if (ids.Length > 0)
{
return cms.DownloadZip(this, ids.Split(','), fileName);
}
else
{
return cms.ProvideFile(this, id, fn, oldURL);
}

}
}
}
Loading

0 comments on commit ca57771

Please sign in to comment.