Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 97837a0

Browse files
author
rahulgarg1985
committed
CodeNode Initial Commit
Started a project as a collection pluggable reusable.
1 parent 58a13f6 commit 97837a0

File tree

182 files changed

+315257
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+315257
-0
lines changed

CodeNode.ActiveDirectory/ActiveDirectoryManager.cs

Lines changed: 398 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{ACB904A4-DB76-434B-A952-0F24AEABB5AB}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>CodeNode.ActiveDirectory</RootNamespace>
11+
<AssemblyName>CodeNode.ActiveDirectory</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<Prefer32Bit>false</Prefer32Bit>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<Prefer32Bit>false</Prefer32Bit>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.DirectoryServices" />
39+
<Reference Include="System.DirectoryServices.AccountManagement" />
40+
<Reference Include="System.Web" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="ActiveDirectoryManager.cs" />
44+
<Compile Include="Helper.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
<Compile Include="SearchOn.cs" />
47+
<Compile Include="UserSearchCriteria.cs" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<ProjectReference Include="..\CodeNode.Core\CodeNode.Core.csproj">
51+
<Project>{fa0d8f27-a760-479e-8f46-9059158629d1}</Project>
52+
<Name>CodeNode.Core</Name>
53+
</ProjectReference>
54+
<ProjectReference Include="..\CodeNode.Extention\CodeNode.Extention.csproj">
55+
<Project>{8332ef8b-578d-4bc1-9589-bf4823b7834b}</Project>
56+
<Name>CodeNode.Extention</Name>
57+
</ProjectReference>
58+
</ItemGroup>
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
61+
Other similar extension points exist, see Microsoft.Common.targets.
62+
<Target Name="BeforeBuild">
63+
</Target>
64+
<Target Name="AfterBuild">
65+
</Target>
66+
-->
67+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ProjectView>ProjectFiles</ProjectView>
5+
</PropertyGroup>
6+
</Project>

CodeNode.ActiveDirectory/Helper.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.DirectoryServices;
3+
using System.DirectoryServices.AccountManagement;
4+
using System.Globalization;
5+
using System.Security.Principal;
6+
using System.Web;
7+
8+
namespace CodeNode.ActiveDirectory
9+
{
10+
public class Helper
11+
{
12+
public static Guid GetCurrentUserAdGuid()
13+
{
14+
var userGuid = Guid.Empty;
15+
const string ldapPath = "LDAP://<SID={0}>";
16+
17+
var userWinId = HttpContext.Current.User.Identity as WindowsIdentity;
18+
19+
if (userWinId != null)
20+
{
21+
var userSid = userWinId.User;
22+
23+
if (userSid != null)
24+
{
25+
using (var userDirEntry = new DirectoryEntry(
26+
string.Format(CultureInfo.CurrentCulture, ldapPath, userSid.Value)
27+
))
28+
{
29+
userGuid = userDirEntry.Guid;
30+
}
31+
}
32+
}
33+
34+
if (userGuid == Guid.Empty)
35+
userGuid = UserPrincipal.Current.Guid.HasValue
36+
? UserPrincipal.Current.Guid.Value
37+
: Guid.Empty;
38+
39+
return userGuid;
40+
}
41+
}
42+
}
145 KB
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
8+
[assembly: AssemblyTitle("CodeNode.ActiveDirectory")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("CodeNode.ActiveDirectory")]
13+
[assembly: AssemblyCopyright("")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
21+
[assembly: ComVisible(false)]
22+
23+
// The following GUID is for the ID of the typelib if this project is exposed to COM
24+
25+
[assembly: Guid("0f81f931-5f37-4028-9e69-8c630c26dbcd")]
26+
27+
// Version information for an assembly consists of the following four values:
28+
//
29+
// Major Version
30+
// Minor Version
31+
// Build Number
32+
// Revision
33+
//
34+
// You can specify all the values or you can default the Build and Revision Numbers
35+
// by using the '*' as shown below:
36+
// [assembly: AssemblyVersion("1.0.*")]
37+
38+
[assembly: AssemblyVersion("1.0.0.0")]
39+
[assembly: AssemblyFileVersion("1.0.0.0")]

CodeNode.ActiveDirectory/SearchOn.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace CodeNode.ActiveDirectory
2+
{
3+
public enum SearchOn
4+
{
5+
Description = 1,
6+
Guid = 2,
7+
Name = 3,
8+
SamAccountName = 4,
9+
//Sid should be System.Security.IdentityReference
10+
Sid = 5,
11+
UserPricipalName = 6,
12+
Email = 7,
13+
Firstname = 8,
14+
MiddleName = 9,
15+
SurName = 10
16+
}
17+
}

CodeNode.ActiveDirectory/Untitled.png

155 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace CodeNode.ActiveDirectory
2+
{
3+
public class UserSearchCriteria
4+
{
5+
public string SearchValue { get; set; }
6+
public string GroupName { get; set; }
7+
public SearchOn Parameter { get; set; }
8+
public bool ExactMatch { get; set; }
9+
}
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\obj\Debug\CodeNode.ActiveDirectory.csprojResolveAssemblyReference.cache
2+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.ActiveDirectory.dll
3+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.ActiveDirectory.pdb
4+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.Core.dll
5+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.Extention.dll
6+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.Core.pdb
7+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\bin\Debug\CodeNode.Extention.pdb
8+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\obj\Debug\CodeNode.ActiveDirectory.dll
9+
C:\BCG\Rahul\RAndD\Helper\Helper.ActiveDirectory\obj\Debug\CodeNode.ActiveDirectory.pdb

0 commit comments

Comments
 (0)