def all_members
      # filters used to determine if each group member is a User or Group
      group_filter = "(objectClass=#{Cratus.config.group_objectclass})"
      user_filter  = "(objectClass=#{Cratus.config.user_objectclass})"

      # The raw LDAP data (a list of DNs)
      raw_members = @raw_ldap_data[Cratus.config.group_member_attribute]

      # Somewhere to store users and groups as we gather them
      results = { users: [], groups: [] }

      # Iterate over the members and provide a user or group
      raw_members.each do |member|
        user_result = Cratus::LDAP.search(
          user_filter,
          basedn: member,
          scope: 'object',
          attrs: User.ldap_return_attributes
        )

        if !user_result.nil? && !user_result.empty?
          results[:users] << User.new(user_result.last[User.ldap_dn_attribute.to_sym].last)
        else
          group_result = Cratus::LDAP.search(
            group_filter,
            basedn: member,
            scope: 'object',
            attrs: self.class.ldap_return_attributes
          )
          unless group_result.nil? || group_result.empty?
            nested_group = Group.new(group_result.last[self.class.ldap_dn_attribute.to_sym].last)
            results[:groups] << nested_group
            results[:groups].concat(nested_group.member_groups)
            results[:users].concat(nested_group.members)
          end
        end
      end

      # deliver the results
      results[:groups].uniq!(&:name)
      results[:users].uniq!(&:username)
      results
    end
def all_members
      # filters used to determine if each group member is a User or Group
      group_filter = "(objectClass=#{Cratus.config.group_objectclass})"
      user_filter  = "(objectClass=#{Cratus.config.user_objectclass})"

      # The raw LDAP data (a list of DNs)
      raw_members = @raw_ldap_data[Cratus.config.group_member_attribute]

      # Somewhere to store users and groups as we gather them
      results = { users: [], groups: [] }

      # Iterate over the members and provide a user or group
      raw_members.each do |member|
        user_result = Cratus::LDAP.search(
          user_filter,
          basedn: member,
          scope: 'object',
          attrs: User.ldap_return_attributes
        )

        if !user_result.nil? && !user_result.empty?
          results[:users] << User.new(user_result.last[User.ldap_dn_attribute.to_sym].last)
        else
          group_result = Cratus::LDAP.search(
            group_filter,
            basedn: member,
            scope: 'object',
            attrs: self.class.ldap_return_attributes
          )
          unless group_result.nil? || group_result.empty?
            nested_group = Group.new(group_result.last[self.class.ldap_dn_attribute.to_sym].last)
            results[:groups] << nested_group
            results[:groups].concat(nested_group.member_groups)
            results[:users].concat(nested_group.members)
          end
        end
      end

      # deliver the results
      results[:groups].uniq!(&:name)
      results[:users].uniq!(&:username)
      results
    end
provides a Hash of member users and groups
   rubocop:disable Metrics/AbcSize, Metrics/MethodLength