Skip to content

Instantly share code, notes, and snippets.

@rolfschmidt
Created August 15, 2024 07:44
Show Gist options
  • Select an option

  • Save rolfschmidt/80f125c6e6281bac716b8d1bc71a26a5 to your computer and use it in GitHub Desktop.

Select an option

Save rolfschmidt/80f125c6e6281bac716b8d1bc71a26a5 to your computer and use it in GitHub Desktop.
User role mapping count
LdapSource.find_each do |source|
ldap_config = source.preferences
ldap_connection = ::Ldap.new(ldap_config)
group_config = {
filter: ldap_config[:group_filter]
}
ldap_group = ::Ldap::Group.new(group_config, ldap: ldap_connection)
dn_roles = ldap_group.user_roles(ldap_config[:group_role_map])
puts "Matched count of #{dn_roles.count} for ldap source #{source.id}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment