Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix createchildusergroup #11

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ _ReSharper.*/
AssemblyInfo.cs
*.user
/Rhino.Security/Rhino.Security.xml
/Rhino.Security/Rhino.Security.XML
/Rhino.Security/Rhino.Security.XML

[Pp]ackages
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RegisterRhinoSecurityMappingAttribute.cs" />
<Compile Include="RegisterRhinoSecurityModels.cs" />
<Compile Include="RhinoSecurity.cs" />
Expand Down Expand Up @@ -113,6 +112,9 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</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.
Expand Down
43 changes: 43 additions & 0 deletions Rhino.Security.Tests/ScenariosFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ public void DeeplyNestedUsersGroup()
Assert.Equal(51, groups.Length);
}

[Fact]
public void DeeplyNestedUsersGroupCountOfChildren()
{
UsersGroup group = authorizationRepository.CreateUsersGroup("Parent");

for (int j = 0; j < 50; j++)
{
authorizationRepository.CreateChildUserGroupOf(group.Name, "Direct Child #" + j);

}

for (int j = 0; j < 50; j++)
{
group = authorizationRepository.CreateChildUserGroupOf(group.Name, "Child #" + j);

}
group = authorizationRepository.GetUsersGroupByName("Parent");
Assert.Equal(51, group.DirectChildren.Count);
Assert.Equal(100, group.AllChildren.Count);
}

[Fact]
public void DeeplyNestedEntitiesGroup()
{
Expand All @@ -38,6 +59,28 @@ public void DeeplyNestedEntitiesGroup()
EntitiesGroup[] groups = authorizationRepository.GetAncestryAssociationOfEntity(account, "Root");
Assert.Equal(51, groups.Length);
}

[Fact]
public void DeeplyNestedEntitiesGroupCountOfChildren()
{
EntitiesGroup group = authorizationRepository.CreateEntitiesGroup("Parent");

for (int j = 0; j < 50; j++)
{
authorizationRepository.CreateChildEntityGroupOf(group.Name, "Direct Child #" + j);

}

for (int j = 0; j < 50; j++)
{
group = authorizationRepository.CreateChildEntityGroupOf(group.Name, "Child #" + j);

}
group = authorizationRepository.GetEntitiesGroupByName("Parent");
Assert.Equal(51, group.DirectChildren.Count);
Assert.Equal(100, group.AllChildren.Count);
}

//Todo: had to session flush for the test pass.
[Fact]
public void CanOnlyAssignAccountsThatAreAssignedToMe()
Expand Down
4 changes: 3 additions & 1 deletion Rhino.Security.Windsor/Rhino.Security.Windsor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="RhinoSecurityInstaller.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rhino.Security\Rhino.Security.csproj">
Expand All @@ -73,6 +72,9 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</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.
Expand Down
1 change: 0 additions & 1 deletion Rhino.Security/Rhino.Security.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<Compile Include="IUser.cs" />
<Compile Include="Model\Operation.cs" />
<Compile Include="Model\Permission.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
Expand Down
Loading