mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-24 19:08:18 +08:00
Continued implementation of model infrastructure. Adding orchard security providers. Adding Users package.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4039302
This commit is contained in:
parent
fe64cea912
commit
f0b46afc84
61
src/Orchard.Tests.Packages/Orchard.Tests.Packages.csproj
Normal file
61
src/Orchard.Tests.Packages/Orchard.Tests.Packages.csproj
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.Tests.Packages</RootNamespace>
|
||||
<AssemblyName>Orchard.Tests.Packages</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Users\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
src/Orchard.Tests.Packages/Properties/AssemblyInfo.cs
Normal file
36
src/Orchard.Tests.Packages/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.Tests.Packages")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft IT")]
|
||||
[assembly: AssemblyProduct("Orchard.Tests.Packages")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft IT 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("48eebfb4-714d-4859-829a-15fbe7e1bc9f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -28,7 +28,7 @@ namespace Orchard.Tests {
|
||||
private static void AddAlterations(AutoMappingAlterationCollection alterations, Type[] types) {
|
||||
foreach (var assembly in types.Select(t => t.Assembly).Distinct()) {
|
||||
alterations.Add(new AutoMappingOverrideAlteration(assembly));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ISessionFactory CreateSessionFactory(params Type[] types) {
|
||||
|
@ -2,9 +2,12 @@
|
||||
using Autofac;
|
||||
using Autofac.Builder;
|
||||
using Autofac.Modules;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Data;
|
||||
using Orchard.Models;
|
||||
using Orchard.Models.Driver;
|
||||
using Orchard.Models.Records;
|
||||
using Orchard.Tests.Models.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Models {
|
||||
@ -12,6 +15,23 @@ namespace Orchard.Tests.Models {
|
||||
public class DefaultModelBuilderTests {
|
||||
private IContainer _container;
|
||||
private IModelManager _manager;
|
||||
private ISessionFactory _sessionFactory;
|
||||
private ISession _session;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void InitFixture() {
|
||||
var databaseFileName = System.IO.Path.GetTempFileName();
|
||||
_sessionFactory = DataUtility.CreateSessionFactory(
|
||||
databaseFileName,
|
||||
typeof(ModelRecord),
|
||||
typeof(ModelTypeRecord),
|
||||
typeof(GammaRecord));
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void TermFixture() {
|
||||
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Init() {
|
||||
@ -20,17 +40,35 @@ namespace Orchard.Tests.Models {
|
||||
builder.Register<DefaultModelManager>().As<IModelManager>();
|
||||
builder.Register<AlphaDriver>().As<IModelDriver>();
|
||||
builder.Register<BetaDriver>().As<IModelDriver>();
|
||||
builder.Register<GammaDriver>().As<IModelDriver>();
|
||||
builder.Register<FlavoredDriver>().As<IModelDriver>();
|
||||
builder.Register<StyledDriver>().As<IModelDriver>();
|
||||
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.Register(new TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
|
||||
_container = builder.Build();
|
||||
_manager = _container.Resolve<IModelManager>();
|
||||
}
|
||||
|
||||
public class TestSessionLocator : ISessionLocator {
|
||||
private readonly ISession _session;
|
||||
|
||||
public TestSessionLocator(ISession session) {
|
||||
_session = session;
|
||||
}
|
||||
|
||||
public ISession For(Type entityType) {
|
||||
return _session;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AlphaDriverShouldWeldItsPart() {
|
||||
var foo = _manager.New("alpha");
|
||||
|
||||
|
||||
Assert.That(foo.Is<Alpha>(), Is.True);
|
||||
Assert.That(foo.As<Alpha>(), Is.Not.Null);
|
||||
Assert.That(foo.Is<Beta>(), Is.False);
|
||||
@ -46,7 +84,7 @@ namespace Orchard.Tests.Models {
|
||||
|
||||
[Test, ExpectedException(typeof(InvalidCastException))]
|
||||
public void StronglyTypedNewShouldThrowCastExceptionIfNull() {
|
||||
var foo = _manager.New<Beta>("alpha");
|
||||
_manager.New<Beta>("alpha");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -60,5 +98,59 @@ namespace Orchard.Tests.Models {
|
||||
Assert.That(beta.Is<Styled>(), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetByIdShouldDetermineTypeAndLoadParts() {
|
||||
var modelRecord = CreateModelRecord("alpha");
|
||||
|
||||
var model = _manager.Get(modelRecord.Id);
|
||||
Assert.That(model.ModelType, Is.EqualTo("alpha"));
|
||||
Assert.That(model.Id, Is.EqualTo(modelRecord.Id));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ModelPartWithRecordShouldCallRepositoryToPopulate() {
|
||||
|
||||
var modelRecord = CreateModelRecord("gamma");
|
||||
|
||||
var model = _manager.Get(modelRecord.Id);
|
||||
|
||||
// create a gamma record
|
||||
var gamma = new GammaRecord {
|
||||
Model = _container.Resolve<IRepository<ModelRecord>>().Get(model.Id),
|
||||
Frap = "foo"
|
||||
};
|
||||
|
||||
_container.Resolve<IRepository<GammaRecord>>().Create(gamma);
|
||||
_session.Flush();
|
||||
_session.Clear();
|
||||
|
||||
// re-fetch from database
|
||||
model = _manager.Get(modelRecord.Id);
|
||||
|
||||
Assert.That(model.ModelType, Is.EqualTo("gamma"));
|
||||
Assert.That(model.Id, Is.EqualTo(modelRecord.Id));
|
||||
Assert.That(model.Is<Gamma>(), Is.True);
|
||||
Assert.That(model.As<Gamma>().Record, Is.Not.Null);
|
||||
Assert.That(model.As<Gamma>().Record.Model.Id, Is.EqualTo(model.Id));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private ModelRecord CreateModelRecord(string modelType) {
|
||||
var modelRepository = _container.Resolve<IRepository<ModelRecord>>();
|
||||
var modelTypeRepository = _container.Resolve<IRepository<ModelTypeRecord>>();
|
||||
|
||||
var modelRecord = new ModelRecord { ModelType = new ModelTypeRecord { Name = modelType } };
|
||||
modelTypeRepository.Create(modelRecord.ModelType);
|
||||
modelRepository.Create(modelRecord);
|
||||
|
||||
_session.Flush();
|
||||
_session.Clear();
|
||||
return modelRecord;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Orchard.Models.Driver;
|
||||
|
||||
namespace Orchard.Tests.Models.Stubs {
|
||||
public class AlphaDriver : ModelDriverBase {
|
||||
public class AlphaDriver : ModelDriver {
|
||||
protected override void New(NewModelContext context) {
|
||||
if (context.ModelType == "alpha") {
|
||||
WeldModelPart<Alpha>(context);
|
||||
|
@ -5,7 +5,7 @@ using System.Text;
|
||||
using Orchard.Models.Driver;
|
||||
|
||||
namespace Orchard.Tests.Models.Stubs {
|
||||
public class BetaDriver : ModelDriverBase {
|
||||
public class BetaDriver : ModelDriver {
|
||||
protected override void New(NewModelContext context) {
|
||||
if (context.ModelType == "beta") {
|
||||
WeldModelPart<Beta>(context);
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Orchard.Models.Driver;
|
||||
|
||||
namespace Orchard.Tests.Models.Stubs {
|
||||
public class FlavoredDriver : ModelDriverBase {
|
||||
public class FlavoredDriver : ModelDriver {
|
||||
protected override void New(NewModelContext context) {
|
||||
if (context.ModelType == "beta" || context.ModelType == "alpha") {
|
||||
WeldModelPart<Flavored>(context);
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Orchard.Models.Driver;
|
||||
|
||||
namespace Orchard.Tests.Models.Stubs {
|
||||
public class StyledDriver : ModelDriverBase {
|
||||
public class StyledDriver : ModelDriver {
|
||||
protected override void New(NewModelContext context) {
|
||||
if (context.ModelType == "alpha") {
|
||||
WeldModelPart<Styled>(context);
|
||||
|
@ -111,6 +111,7 @@
|
||||
<Compile Include="Models\Stubs\BetaDriver.cs" />
|
||||
<Compile Include="Models\Stubs\Flavored.cs" />
|
||||
<Compile Include="Models\Stubs\FlavoredDriver.cs" />
|
||||
<Compile Include="Models\Stubs\Gamma.cs" />
|
||||
<Compile Include="Models\Stubs\Styled.cs" />
|
||||
<Compile Include="Models\Stubs\StyledDriver.cs" />
|
||||
<Compile Include="Mvc\ModelBinders\KeyedListModelBinderTests.cs" />
|
||||
@ -130,8 +131,6 @@
|
||||
<Compile Include="Records\Foo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Stubs\StubHttpContext.cs" />
|
||||
<Compile Include="Utility\ReflectOnTests.cs" />
|
||||
<Compile Include="Utility\ReflectTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Orchard\Orchard.csproj">
|
||||
@ -142,6 +141,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Utility\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -130,6 +130,10 @@
|
||||
<Project>{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}</Project>
|
||||
<Name>Orchard.Media</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="Packages\Orchard.Users\Orchard.Users.csproj">
|
||||
<Project>{79AED36E-ABD0-4747-93D3-8722B042454B}</Project>
|
||||
<Name>Orchard.Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Admin\images\background_header.jpg" />
|
||||
|
@ -0,0 +1,10 @@
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Users.Controllers {
|
||||
public class AdminController : Controller {
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Users.Controllers {
|
||||
[HandleError]
|
||||
public class HomeController : Controller {
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
122
src/Orchard.Web/Packages/Orchard.Users/Orchard.Users.csproj
Normal file
122
src/Orchard.Web/Packages/Orchard.Users/Orchard.Users.csproj
Normal file
@ -0,0 +1,122 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{79AED36E-ABD0-4747-93D3-8722B042454B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.Users</RootNamespace>
|
||||
<AssemblyName>Orchard.Users</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\Program Files\Microsoft ASP.NET\ASP.NET MVC 2\\Assemblies\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Content\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Scripts\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<!-- To enable MVC area subproject support, uncomment the following two lines:
|
||||
<UsingTask TaskName="Microsoft.Web.Mvc.Build.CreateAreaManifest" AssemblyName="Microsoft.Web.Mvc.Build, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<UsingTask TaskName="Microsoft.Web.Mvc.Build.CopyAreaManifests" AssemblyName="Microsoft.Web.Mvc.Build, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
-->
|
||||
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
|
||||
<PropertyGroup>
|
||||
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
|
||||
</PropertyGroup>
|
||||
<!-- If this is an area child project, uncomment the following line:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
-->
|
||||
<!-- If this is an area parent project, uncomment the following lines:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
|
||||
-->
|
||||
</Target>
|
||||
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>40373</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.Users")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft IT")]
|
||||
[assembly: AssemblyProduct("Orchard.Users")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft IT 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("700045c0-0c7d-44f9-9b09-ca4364d1e9fb")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
34
src/Orchard.Web/Packages/Orchard.Users/Views/Web.config
Normal file
34
src/Orchard.Web/Packages/Orchard.Users/Views/Web.config
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add path="*" verb="*"
|
||||
type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
205
src/Orchard.Web/Packages/Orchard.Users/Web.config
Normal file
205
src/Orchard.Web/Packages/Orchard.Users/Web.config
Normal file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Note: As an alternative to hand editing this file you can use the
|
||||
web admin tool to configure settings for your application. Use
|
||||
the Website->Asp.Net Configuration option in Visual Studio.
|
||||
A full list of settings and comments can be found in
|
||||
machine.config.comments usually located in
|
||||
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||
-->
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<appSettings/>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
|
||||
<system.web>
|
||||
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
symbols into the compiled page. Because this
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="false">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
|
||||
<!--
|
||||
The <authentication> section enables configuration
|
||||
of the security authentication mode used by
|
||||
ASP.NET to identify an incoming user.
|
||||
-->
|
||||
<authentication mode="Forms">
|
||||
<forms loginUrl="~/Account/LogOn" timeout="2880" />
|
||||
</authentication>
|
||||
|
||||
<membership>
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlMembershipProvider"
|
||||
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
enablePasswordRetrieval="false"
|
||||
enablePasswordReset="true"
|
||||
requiresQuestionAndAnswer="false"
|
||||
requiresUniqueEmail="false"
|
||||
passwordFormat="Hashed"
|
||||
maxInvalidPasswordAttempts="5"
|
||||
minRequiredPasswordLength="6"
|
||||
minRequiredNonalphanumericCharacters="0"
|
||||
passwordAttemptWindow="10"
|
||||
passwordStrengthRegularExpression=""
|
||||
applicationName="/"
|
||||
/>
|
||||
</providers>
|
||||
</membership>
|
||||
|
||||
<profile>
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlProfileProvider"
|
||||
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
applicationName="/"
|
||||
/>
|
||||
</providers>
|
||||
</profile>
|
||||
|
||||
<roleManager enabled="false">
|
||||
<providers>
|
||||
<clear />
|
||||
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
|
||||
<!--
|
||||
The <customErrors> section enables configuration
|
||||
of what to do if/when an unhandled error occurs
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpModules>
|
||||
|
||||
</system.web>
|
||||
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="OptionInfer" value="true"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
|
||||
<system.web.extensions/>
|
||||
|
||||
<!--
|
||||
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||
-->
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<remove name="ScriptModule" />
|
||||
<remove name="UrlRoutingModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</modules>
|
||||
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<remove name="MvcHttpHandler" />
|
||||
<remove name="UrlRoutingHandler" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
@ -61,10 +61,10 @@
|
||||
<forms loginUrl="~/Account/LogOn" timeout="2880" />
|
||||
</authentication>
|
||||
|
||||
<membership>
|
||||
<membership defaultProvider="OrchardMembershipProvider">
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlMembershipProvider"
|
||||
<!--<add name="AspNetSqlMembershipProvider"
|
||||
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
enablePasswordRetrieval="false"
|
||||
@ -78,7 +78,9 @@
|
||||
passwordAttemptWindow="10"
|
||||
passwordStrengthRegularExpression=""
|
||||
applicationName="/"
|
||||
/>
|
||||
/>-->
|
||||
<add name="OrchardMembershipProvider" type="Orchard.Security.Providers.OrchardMembershipProvider, Orchard"
|
||||
applicationName="/" />
|
||||
</providers>
|
||||
</membership>
|
||||
|
||||
@ -96,6 +98,7 @@
|
||||
<roleManager enabled="false">
|
||||
<providers>
|
||||
<clear />
|
||||
<add name="OrchardRoleProvider" type="Orchard.Security.Providers.OrchardRoleProvider, Orchard"/>
|
||||
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</providers>
|
||||
|
@ -25,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.XmlRpc", "Orchard.W
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.XmlRpc.Tests", "Orchard.Web\Packages\Orchard.XmlRpc.Tests\Orchard.XmlRpc.Tests.csproj", "{58506223-CB7D-474F-B936-6E17D53B0FB8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Users", "Orchard.Web\Packages\Orchard.Users\Orchard.Users.csproj", "{79AED36E-ABD0-4747-93D3-8722B042454B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tests.Packages", "Orchard.Tests.Packages\Orchard.Tests.Packages.csproj", "{6CB3EB30-F725-45C0-9742-42599BA8E8D2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 9
|
||||
@ -130,6 +134,14 @@ Global
|
||||
{58506223-CB7D-474F-B936-6E17D53B0FB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{58506223-CB7D-474F-B936-6E17D53B0FB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58506223-CB7D-474F-B936-6E17D53B0FB8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -142,5 +154,6 @@ Global
|
||||
{15CFEF40-F2C2-44DD-ADAF-18A26DA2320C} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{0DC6B598-6D03-4923-A6C2-274D09854117} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{58506223-CB7D-474F-B936-6E17D53B0FB8} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -36,6 +36,7 @@ namespace Orchard.Environment {
|
||||
_current = runtime;
|
||||
|
||||
_controllerBuilder.SetControllerFactory(new OrchardControllerFactory());
|
||||
ServiceLocator.SetLocator(t=>_containerProvider.RequestContainer.Resolve(t));
|
||||
}
|
||||
|
||||
protected virtual void EndRequest() {
|
||||
|
19
src/Orchard/Environment/ServiceLocator.cs
Normal file
19
src/Orchard/Environment/ServiceLocator.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Orchard.Environment {
|
||||
public static class ServiceLocator {
|
||||
private static Func<Type, object> _locator;
|
||||
|
||||
public static void SetLocator(Func<Type, object> locator) {
|
||||
_locator = locator;
|
||||
}
|
||||
|
||||
public static T Resolve<T>() {
|
||||
return (T)_locator(typeof(T));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Data;
|
||||
using Orchard.Models.Driver;
|
||||
using Orchard.Models.Records;
|
||||
|
||||
namespace Orchard.Models {
|
||||
public class DefaultModelManager : IModelManager {
|
||||
private readonly IEnumerable<IModelDriver> _drivers;
|
||||
private readonly IRepository<ModelRecord> _modelRepository;
|
||||
|
||||
public DefaultModelManager(IEnumerable<IModelDriver> drivers) {
|
||||
public DefaultModelManager(
|
||||
IEnumerable<IModelDriver> drivers,
|
||||
IRepository<ModelRecord> modelRepository) {
|
||||
_drivers = drivers;
|
||||
_modelRepository = modelRepository;
|
||||
}
|
||||
|
||||
public virtual IModel New(string modelType) {
|
||||
|
||||
|
||||
// create a new kernel for the model instance
|
||||
var context = new NewModelContext {
|
||||
ModelType = modelType,
|
||||
@ -18,12 +25,34 @@ namespace Orchard.Models {
|
||||
};
|
||||
|
||||
// invoke drivers to weld aspects onto kernel
|
||||
foreach(var driver in _drivers) {
|
||||
foreach (var driver in _drivers) {
|
||||
driver.New(context);
|
||||
}
|
||||
|
||||
// composite result is returned
|
||||
return context.Instance;
|
||||
}
|
||||
|
||||
public virtual IModel Get(int id) {
|
||||
// obtain root record to determine the model type
|
||||
var modelRecord = _modelRepository.Get(id);
|
||||
|
||||
// create a context with a new instance to load
|
||||
var context = new LoadModelContext {
|
||||
Id = modelRecord.Id,
|
||||
ModelType = modelRecord.ModelType.Name,
|
||||
Instance = New(modelRecord.ModelType.Name)
|
||||
};
|
||||
|
||||
// set the id
|
||||
context.Instance.As<ModelRoot>().Id = context.Id;
|
||||
|
||||
// invoke drivers to weld aspects onto kernel
|
||||
foreach (var driver in _drivers) {
|
||||
driver.Load(context);
|
||||
}
|
||||
|
||||
return context.Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,6 @@
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Models.Driver {
|
||||
namespace Orchard.Models.Driver {
|
||||
public interface IModelDriver : IDependency {
|
||||
void New(NewModelContext context);
|
||||
}
|
||||
|
||||
public abstract class ModelDriverBase : IModelDriver {
|
||||
protected ModelDriverBase() {
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger{ get; set;}
|
||||
|
||||
void IModelDriver.New(NewModelContext context) {New(context);}
|
||||
|
||||
protected virtual void New(NewModelContext context) {
|
||||
}
|
||||
|
||||
protected void WeldModelPart<TPart>(NewModelContext context) where TPart : class,IModel,new() {
|
||||
var newPart = new TPart();
|
||||
newPart.Weld(context.Instance);
|
||||
context.Instance = newPart;
|
||||
}
|
||||
|
||||
void Load(LoadModelContext context);
|
||||
}
|
||||
}
|
43
src/Orchard/Models/Driver/ModelDriver.cs
Normal file
43
src/Orchard/Models/Driver/ModelDriver.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Orchard.Data;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Models.Driver {
|
||||
public class ModelDriver : IModelDriver {
|
||||
protected ModelDriver() {
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger{ get; set;}
|
||||
|
||||
void IModelDriver.New(NewModelContext context) {New(context);}
|
||||
void IModelDriver.Load(LoadModelContext context) {Load(context);}
|
||||
|
||||
protected virtual void New(NewModelContext context) {
|
||||
}
|
||||
|
||||
protected virtual void Load(LoadModelContext context) {
|
||||
}
|
||||
|
||||
protected void WeldModelPart<TPart>(NewModelContext context) where TPart : class,IModel,new() {
|
||||
var newPart = new TPart();
|
||||
newPart.Weld(context.Instance);
|
||||
context.Instance = newPart;
|
||||
}
|
||||
}
|
||||
|
||||
public class ModelDriver<TRecord> : ModelDriver {
|
||||
private readonly IRepository<TRecord> _repository;
|
||||
|
||||
public ModelDriver(IRepository<TRecord> repository) {
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
protected override void Load(LoadModelContext context) {
|
||||
var instance = context.Instance.As<ModelPart<TRecord>>();
|
||||
if (instance != null)
|
||||
instance.Record = _repository.Get(context.Id);
|
||||
|
||||
base.Load(context);
|
||||
}
|
||||
}
|
||||
}
|
@ -3,4 +3,9 @@ namespace Orchard.Models.Driver {
|
||||
public string ModelType { get; set; }
|
||||
public IModel Instance { get; set; }
|
||||
}
|
||||
public class LoadModelContext {
|
||||
public int Id { get; set; }
|
||||
public string ModelType { get; set; }
|
||||
public IModel Instance { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
namespace Orchard.Models {
|
||||
public interface IModelManager {
|
||||
IModel New(string modelType);
|
||||
IModel Get(int id);
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,14 @@ namespace Orchard.Models {
|
||||
return Root.WeldedAs<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ModelPart<TRecord> : ModelPart {
|
||||
private TRecord _record;
|
||||
|
||||
public TRecord Record {
|
||||
get { return _record; }
|
||||
set {_record = value;}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
6
src/Orchard/Models/Records/ModelRecord.cs
Normal file
6
src/Orchard/Models/Records/ModelRecord.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Orchard.Models.Records {
|
||||
public class ModelRecord {
|
||||
public virtual int Id { get; set; }
|
||||
public virtual ModelTypeRecord ModelType { get; set; }
|
||||
}
|
||||
}
|
6
src/Orchard/Models/Records/ModelTypeRecord.cs
Normal file
6
src/Orchard/Models/Records/ModelTypeRecord.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Orchard.Models.Records {
|
||||
public class ModelTypeRecord {
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
}
|
||||
}
|
@ -60,6 +60,7 @@
|
||||
<HintPath>..\..\lib\linqnhibernate\NHibernate.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@ -114,6 +115,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Data\Conventions\AttributeCollectionConvention.cs" />
|
||||
<Compile Include="Data\Conventions\CascadeAllDeleteOrphanAttribute.cs" />
|
||||
<Compile Include="Environment\ServiceLocator.cs" />
|
||||
<Compile Include="Logging\CastleLogger.cs" />
|
||||
<Compile Include="Logging\CastleLoggerFactory.cs" />
|
||||
<Compile Include="Logging\ILogger.cs" />
|
||||
@ -123,6 +125,7 @@
|
||||
<Compile Include="Logging\NullLogger.cs" />
|
||||
<Compile Include="Logging\NullLoggerFactory.cs" />
|
||||
<Compile Include="Models\DefaultModelManager.cs" />
|
||||
<Compile Include="Models\Driver\ModelDriver.cs" />
|
||||
<Compile Include="Models\Driver\NewModelContext.cs" />
|
||||
<Compile Include="Models\IModelManager.cs" />
|
||||
<Compile Include="Models\Driver\IModelDriver.cs" />
|
||||
@ -130,6 +133,8 @@
|
||||
<Compile Include="Models\ModelExtensions.cs" />
|
||||
<Compile Include="Models\ModelPart.cs" />
|
||||
<Compile Include="Models\ModelRoot.cs" />
|
||||
<Compile Include="Models\Records\ModelTypeRecord.cs" />
|
||||
<Compile Include="Models\Records\ModelRecord.cs" />
|
||||
<Compile Include="Mvc\Html\HtmlHelperExtensions.cs" />
|
||||
<Compile Include="Mvc\Filters\FilterProvider.cs" />
|
||||
<Compile Include="Mvc\Filters\FilterResolvingActionInvoker.cs" />
|
||||
@ -146,9 +151,12 @@
|
||||
<Compile Include="Notify\NotifyEntry.cs" />
|
||||
<Compile Include="Notify\NotifyFilter.cs" />
|
||||
<Compile Include="Security\IAuthorizationService.cs" />
|
||||
<Compile Include="Security\IMembershipService.cs" />
|
||||
<Compile Include="Security\IUser.cs" />
|
||||
<Compile Include="Security\Permissions\IPermissionProvider.cs" />
|
||||
<Compile Include="Security\Permissions\Permission.cs" />
|
||||
<Compile Include="Security\Providers\OrchardMembershipProvider.cs" />
|
||||
<Compile Include="Security\Providers\OrchardRoleProvider.cs" />
|
||||
<Compile Include="Services\Clock.cs" />
|
||||
<Compile Include="Storage\FileSystemStorageProvider.cs" />
|
||||
<Compile Include="Storage\IStorageFile.cs" />
|
||||
|
24
src/Orchard/Security/IMembershipService.cs
Normal file
24
src/Orchard/Security/IMembershipService.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Orchard.Security {
|
||||
public interface IMembershipService : IDependency {
|
||||
void ReadSettings(MembershipSettings settings);
|
||||
}
|
||||
|
||||
public class MembershipSettings {
|
||||
public bool EnablePasswordRetrieval { get; set; }
|
||||
public bool EnablePasswordReset { get; set; }
|
||||
public bool RequiresQuestionAndAnswer { get; set; }
|
||||
public int MaxInvalidPasswordAttempts { get; set; }
|
||||
public int PasswordAttemptWindow { get; set; }
|
||||
public bool RequiresUniqueEmail { get; set; }
|
||||
public MembershipPasswordFormat PasswordFormat { get; set; }
|
||||
public int MinRequiredPasswordLength { get; set; }
|
||||
public int MinRequiredNonAlphanumericCharacters { get; set; }
|
||||
public string PasswordStrengthRegularExpression { get; set; }
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ namespace Orchard.Security {
|
||||
/// Interface provided by the "user" model.
|
||||
/// </summary>
|
||||
public interface IUser : IModel {
|
||||
string Name { get; }
|
||||
string UserName { get; }
|
||||
string Email { get; }
|
||||
}
|
||||
}
|
||||
|
117
src/Orchard/Security/Providers/OrchardMembershipProvider.cs
Normal file
117
src/Orchard/Security/Providers/OrchardMembershipProvider.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Security.Providers {
|
||||
public class OrchardMembershipProvider : MembershipProvider {
|
||||
public OrchardMembershipProvider() {
|
||||
int x =5;
|
||||
}
|
||||
|
||||
static IMembershipService GetService() {
|
||||
return ServiceLocator.Resolve<IMembershipService>();
|
||||
}
|
||||
|
||||
static MembershipSettings GetSettings() {
|
||||
var settings = new MembershipSettings {
|
||||
EnablePasswordRetrieval = false,
|
||||
EnablePasswordReset = true,
|
||||
RequiresQuestionAndAnswer = true,
|
||||
RequiresUniqueEmail = true,
|
||||
MaxInvalidPasswordAttempts = 5,
|
||||
PasswordAttemptWindow = 10,
|
||||
MinRequiredPasswordLength = 7,
|
||||
MinRequiredNonAlphanumericCharacters = 1,
|
||||
PasswordStrengthRegularExpression = "",
|
||||
PasswordFormat = MembershipPasswordFormat.Hashed,
|
||||
};
|
||||
GetService().ReadSettings(settings);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string GetPassword(string username, string answer) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool ChangePassword(string username, string oldPassword, string newPassword) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string ResetPassword(string username, string answer) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void UpdateUser(MembershipUser user) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool ValidateUser(string username, string password) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool UnlockUser(string userName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUser GetUser(string username, bool userIsOnline) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string GetUserNameByEmail(string email) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool DeleteUser(string username, bool deleteAllRelatedData) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override int GetNumberOfUsersOnline() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string ApplicationName {
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override bool EnablePasswordRetrieval { get { return GetSettings().EnablePasswordRetrieval; } }
|
||||
public override bool EnablePasswordReset { get { return GetSettings().EnablePasswordReset; } }
|
||||
public override bool RequiresQuestionAndAnswer { get { return GetSettings().RequiresQuestionAndAnswer; } }
|
||||
public override int MaxInvalidPasswordAttempts { get { return GetSettings().MaxInvalidPasswordAttempts; } }
|
||||
public override int PasswordAttemptWindow { get { return GetSettings().PasswordAttemptWindow; } }
|
||||
public override bool RequiresUniqueEmail { get { return GetSettings().RequiresUniqueEmail; } }
|
||||
public override MembershipPasswordFormat PasswordFormat { get { return GetSettings().PasswordFormat; } }
|
||||
public override int MinRequiredPasswordLength { get { return GetSettings().MinRequiredPasswordLength; } }
|
||||
public override int MinRequiredNonAlphanumericCharacters { get { return GetSettings().MinRequiredNonAlphanumericCharacters; } }
|
||||
public override string PasswordStrengthRegularExpression { get { return GetSettings().PasswordStrengthRegularExpression; } }
|
||||
}
|
||||
}
|
54
src/Orchard/Security/Providers/OrchardRoleProvider.cs
Normal file
54
src/Orchard/Security/Providers/OrchardRoleProvider.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Orchard.Security.Providers {
|
||||
public class OrchardRoleProvider : RoleProvider {
|
||||
public override bool IsUserInRole(string username, string roleName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string[] GetRolesForUser(string username) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void CreateRole(string roleName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool RoleExists(string roleName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void AddUsersToRoles(string[] usernames, string[] roleNames) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string[] GetUsersInRole(string roleName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string[] GetAllRoles() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string[] FindUsersInRole(string roleName, string usernameToMatch) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string ApplicationName {
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user