Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/cneuwirt/rhino-security
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Apr 7, 2010
2 parents f748cad + 3c9b030 commit 1a4df0a
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Rhino.Security-vs2008.sln
Expand Up @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Security-vs2008", "Rh
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Security.Tests-vs2008", "Rhino.Security.Tests\Rhino.Security.Tests-vs2008.csproj", "{558B3AE3-C408-4DB0-AC79-386BC12379BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Security.ActiveRecord", "Rhino.Security.ActiveRecord\Rhino.Security.ActiveRecord.csproj", "{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,6 +26,12 @@ Global
{558B3AE3-C408-4DB0-AC79-386BC12379BE}.Release|Any CPU.Build.0 = Release|Any CPU
{558B3AE3-C408-4DB0-AC79-386BC12379BE}.Start|Any CPU.ActiveCfg = Release|Any CPU
{558B3AE3-C408-4DB0-AC79-386BC12379BE}.Start|Any CPU.Build.0 = Release|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Release|Any CPU.Build.0 = Release|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Start|Any CPU.ActiveCfg = Release|Any CPU
{5FCDDA8A-B305-474E-AD27-4DEF6CB042B6}.Start|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
@@ -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 Rhino.Security.ActiveRecord/RegisterRhinoSecurityModels.cs
@@ -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 Rhino.Security.ActiveRecord/Rhino.Security.ActiveRecord.csproj
@@ -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>
18 changes: 18 additions & 0 deletions Rhino.Security.ActiveRecord/RhinoSecurity.cs
@@ -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 added SharedLibs/Castle.ActiveRecord.dll
Binary file not shown.
Binary file added SharedLibs/Rhino.Commons.NHibernate.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions default.ps1
Expand Up @@ -43,6 +43,15 @@ task Init -depends Clean {
-clsCompliant "false" `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009"

Generate-Assembly-Info `
-file "$base_dir\Rhino.Security.ActiveRecord\Properties\AssemblyInfo.cs" `
-title "Rhino Security $version" `
-description "Security Library for NHibernate" `
-company "Hibernating Rhinos" `
-product "Rhino Security $version" `
-version $version `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009"

new-item $release_dir -itemType directory
new-item $buildartifacts_dir -itemType directory
}
Expand Down

0 comments on commit 1a4df0a

Please sign in to comment.