예제 #1
0
        internal ADGroup[] GetPrincipalGroupMembership(string partitionDN, string principalDN, string resourceContextServer, string resourceContextPartition)
        {
            this.Init();
            GetADPrincipalGroupMembershipRequest getADPrincipalGroupMembershipRequest = new GetADPrincipalGroupMembershipRequest();

            getADPrincipalGroupMembershipRequest.PrincipalDN              = principalDN;
            getADPrincipalGroupMembershipRequest.PartitionDN              = partitionDN;
            getADPrincipalGroupMembershipRequest.ResourceContextServer    = resourceContextServer;
            getADPrincipalGroupMembershipRequest.ResourceContextPartition = resourceContextPartition;
            GetADPrincipalGroupMembershipResponse aDPrincipalGroupMembership = this._acctMgmt.GetADPrincipalGroupMembership(this._sessionHandle, getADPrincipalGroupMembershipRequest);
            List <ADGroup> aDGroups = new List <ADGroup>();

            if (aDPrincipalGroupMembership.MemberOf == null)
            {
                return(new ADGroup[0]);
            }
            else
            {
                ActiveDirectoryGroup[] memberOf = aDPrincipalGroupMembership.MemberOf;
                for (int i = 0; i < (int)memberOf.Length; i++)
                {
                    ActiveDirectoryGroup activeDirectoryGroup = memberOf[i];
                    ADGroup aDGroup = new ADGroup();
                    this.PopulateADGroupFromWebServiceData(activeDirectoryGroup, aDGroup);
                    aDGroups.Add(aDGroup);
                }
                return(aDGroups.ToArray());
            }
        }
        GetADPrincipalGroupMembershipResponse Microsoft.ActiveDirectory.Management.IADAccountManagement.GetADPrincipalGroupMembership(ADSessionHandle handle, GetADPrincipalGroupMembershipRequest request)
        {
            GetADPrincipalGroupMembershipResponse aDPrincipalGroupMembership = null;
            ADDirectoryServiceConnection          internalHandle             = this.GetInternalHandle(handle);

            if (internalHandle != null)
            {
                aDPrincipalGroupMembership = internalHandle.GetADPrincipalGroupMembership(request);
            }
            return(aDPrincipalGroupMembership);
        }