Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36306 - Fixing the UserGroup issue when working with RHDS/POSIX #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions lib/ldap_fluff/posix_member_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,35 @@ def find_user(uid, base_dn = @base)

# return an ldap user with groups attached
# note : this method is not particularly fast for large ldap systems
# This group will check all the groups and will match the user. MemberOf plugin
# it's not required for this operation, once this plugin it's optional in ldap.
def find_user_groups(uid)
groups = []
@ldap.search(
:filter => Net::LDAP::Filter.eq('memberuid', uid),
:base => @group_base, :attributes => ["cn"]
).each do |entry|
groups << entry[:cn][0]

search_filter = Net::LDAP::Filter.eq('objectClass', 'groupOfNames')
results_attr = ["cn", "member"]

ldap.search(:filter => search_filter, :attributes => results_attr).each do |grp_info|

grp_info[:member].each do |login|
only_uid = login.split(',')[0].split('=')[1]

if only_uid.include?(uid)
groups << grp_info[:cn]
end
end
end

if groups.length > 0
groups.flatten!
else
groups = []
end
groups
end




def times_in_groups(uid, gids, all)
filters = []
gids.each do |cn|
Expand Down