-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Rhino.Security.ActiveRecord extension back.
- Loading branch information
Showing
9 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Rhino.Security.ActiveRecord/RegisterRhinoSecurityMappingAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Castle.ActiveRecord; | ||
using Castle.ActiveRecord.Framework.Internal; | ||
using Rhino.Security.ActiveRecord; | ||
|
||
[assembly: RegisterRhinoSecurityMapping] | ||
|
||
namespace Rhino.Security.ActiveRecord | ||
{ | ||
public class RegisterRhinoSecurityMappingAttribute : RawXmlMappingAttribute | ||
{ | ||
public override string[] GetMappings() | ||
{ | ||
List<string> mapping = new List<string>(); | ||
ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder(); | ||
foreach (Type type in RhinoSecurity.Entities) | ||
{ | ||
builder.CreateDummyModelFor(type); | ||
Stream stream = type.Assembly.GetManifestResourceStream(type.FullName+".hbm.xml"); | ||
if (stream == null) | ||
continue; | ||
using (StreamReader reader = new StreamReader(stream)) | ||
mapping.Add(reader.ReadToEnd()); | ||
} | ||
return mapping.ToArray(); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Rhino.Security.ActiveRecord/RegisterRhinoSecurityModels.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using Castle.ActiveRecord; | ||
using Castle.ActiveRecord.Framework; | ||
using Castle.ActiveRecord.Framework.Internal; | ||
using NHibernate; | ||
using NHibernate.Cfg; | ||
using Rhino.Commons; | ||
|
||
namespace Rhino.Security.ActiveRecord | ||
{ | ||
public class RegisterRhinoSecurityModels : INHibernateInitializationAware | ||
{ | ||
private readonly ActiveRecordModelBuilder modelBuilder = new ActiveRecordModelBuilder(); | ||
|
||
public void BeforeInitialization() | ||
{ | ||
ActiveRecordStarter.ModelsValidated+=delegate | ||
{ | ||
foreach (Type type in RhinoSecurity.Entities) | ||
{ | ||
modelBuilder.CreateDummyModelFor(type); | ||
} | ||
}; | ||
} | ||
|
||
public void Configured(Configuration cfg) | ||
{ | ||
} | ||
|
||
public void Initialized(Configuration cfg, ISessionFactory sessionFactory) | ||
{ | ||
} | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
Rhino.Security.ActiveRecord/Rhino.Security.ActiveRecord.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?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>{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Rhino.Security.ActiveRecord</RootNamespace> | ||
<AssemblyName>Rhino.Security.ActiveRecord</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="Castle.ActiveRecord, Version=2.0.1000.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\SharedLibs\Castle.ActiveRecord.dll</HintPath> | ||
</Reference> | ||
<Reference Include="NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\SharedLibs\NHibernate.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rhino.Commons.NHibernate, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\SharedLibs\Rhino.Commons.NHibernate.dll</HintPath> | ||
</Reference> | ||
<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" /> | ||
<Compile Include="RegisterRhinoSecurityMappingAttribute.cs" /> | ||
<Compile Include="RegisterRhinoSecurityModels.cs" /> | ||
<Compile Include="RhinoSecurity.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Rhino.Security\Rhino.Security-vs2008.csproj"> | ||
<Project>{DBA372FE-3D52-45B3-AF82-B37696328764}</Project> | ||
<Name>Rhino.Security-vs2008</Name> | ||
</ProjectReference> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using Rhino.Security.Model; | ||
|
||
namespace Rhino.Security.ActiveRecord | ||
{ | ||
internal class RhinoSecurity | ||
{ | ||
internal static Type[] Entities = new Type[] | ||
{ | ||
typeof (EntitiesGroup), | ||
typeof (EntityReference), | ||
typeof (EntityType), | ||
typeof (Operation), | ||
typeof (Permission), | ||
typeof (UsersGroup) | ||
}; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters