public override ArrayList GetGroups() { //Dim adsiConfig As Authentication.ADSI.Configuration = Authentication.ADSI.Configuration.GetConfig(_portalSettings.PortalId) // Normally number of roles in DNN less than groups in Authentication, // so start from DNN roles to get better performance try { // Obtain search object //Dim rootDomain As DirectoryEntry = GetRootDomain() //Dim objSearch As New ADSI.Search(rootDomain) ArrayList colGroup = new ArrayList(); RoleController objRoleController = new RoleController(); ArrayList lstRoles = objRoleController.GetPortalRoles( _portalSettings.PortalId ); RoleInfo objRole; foreach( RoleInfo tempLoopVar_objRole in lstRoles ) { objRole = tempLoopVar_objRole; // Auto assignment roles have been added by DNN, so don't need to get them if( ! objRole.AutoAssignment ) { // It's possible in multiple domains network that search result return more than one group with the same name (i.e Administrators) // We better check them all DirectoryEntry entry; foreach( DirectoryEntry tempLoopVar_entry in Utilities.GetGroupEntriesByName( objRole.RoleName ) ) { entry = tempLoopVar_entry; GroupInfo group = new GroupInfo(); group.PortalID = objRole.PortalID; group.RoleID = objRole.RoleID; group.GUID = entry.NativeGuid; group.Location = Utilities.GetEntryLocation( entry ); group.RoleName = objRole.RoleName; group.Description = objRole.Description; group.ServiceFee = objRole.ServiceFee; group.BillingFrequency = objRole.BillingFrequency; group.TrialPeriod = objRole.TrialPeriod; group.TrialFrequency = objRole.TrialFrequency; group.BillingPeriod = objRole.BillingPeriod; group.TrialFee = objRole.TrialFee; group.IsPublic = objRole.IsPublic; group.AutoAssignment = objRole.AutoAssignment; // Populate member with distingushed name PopulateMembership( group, entry ); colGroup.Add( group ); } } } return colGroup; } catch( COMException exc ) { Exceptions.LogException( exc ); return null; } }
private void PopulateMembership( GroupInfo GroupInfo, DirectoryEntry GroupEntry ) { if( ! GroupInfo.IsPopulated ) { // Populate membership with distinguished name foreach( string strMember in GroupEntry.Properties[ADSI.Configuration.ADSI_MEMBER] ) { //Store DistinguishedName, this method is more accurated GroupInfo.AuthenticationMember.Add( strMember ); } GroupInfo.IsPopulated = true; } }
private void PopulateMembership( GroupInfo GroupInfo ) { //Dim adsiConfig As Authentication.ADSI.Configuration = Authentication.ADSI.Configuration.GetConfig(GroupInfo.PortalID) Domain rootDomain = Utilities.GetRootDomain( Path.GC ); DirectoryEntry groupEntry = Utilities.GetGroupEntryByName( GroupInfo.RoleName ); PopulateMembership( GroupInfo, groupEntry ); }
public override bool IsAuthenticationMember( GroupInfo AuthenticationGroup, UserInfo AuthenticationUser ) { if( ! AuthenticationGroup.IsPopulated ) { PopulateMembership( AuthenticationGroup ); } return AuthenticationGroup.AuthenticationMember.Contains( AuthenticationUser.DistinguishedName ); }
public abstract bool IsAuthenticationMember(GroupInfo AuthenticationGroup, UserInfo AuthenticationUser);
public bool IsAuthenticationMember( GroupInfo AuthenticationGroup, UserInfo AuthenticationUser ) { return AuthenticationProvider.Instance( this.mProviderTypeName ).IsAuthenticationMember( AuthenticationGroup, AuthenticationUser ); }