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

Drop unused methods from PosixMemberService #79

Merged
merged 4 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/ldap_fluff/ad_member_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def find_user_groups(uid)

# return the domain functionality level, default to 0
def _get_domain_func_level
return @domain_functionality unless @domain_functionality.nil?
return @domain_functionality if defined?(@domain_functionality)

@domain_functionality = 0

Expand Down Expand Up @@ -57,7 +57,7 @@ def _walk_group_ancestry(group_dns = [], known_groups = [])
next unless !search.nil? && !search.first.nil?
groups = search.first[:memberof] - known_groups
known_groups += groups
next_level, new_known_groups = _walk_group_ancestry(groups, known_groups)
next_level, _new_known_groups = _walk_group_ancestry(groups, known_groups)
set += next_level
set += groups
known_groups += next_level
Expand Down
21 changes: 0 additions & 21 deletions lib/ldap_fluff/posix_member_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,6 @@ def find_user_groups(uid)
groups
end

def times_in_groups(uid, gids, all)
filters = []
gids.each do |cn|
filters << group_filter(cn)
end
group_filters = merge_filters(filters, all)
filter = name_filter(uid) & group_filters
@ldap.search(:base => @group_base, :filter => filter).size
end

# AND or OR all of the filters together
def merge_filters(filters = [], all = false)
if !filters.nil? && filters.size >= 1
filter = filters[0]
filters[1..(filters.size - 1)].each do |gfilter|
filter = (all ? filter & gfilter : filter | gfilter)
end
filter
end
end

class UIDNotFoundException < LdapFluff::Error
end

Expand Down
3 changes: 2 additions & 1 deletion test/posix_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def test_groups
assert_equal(@posix.groups_for_uid("john"), %w[bros])
end

def test_missing_user
def test_groups_missing_user
service_bind
md = Minitest::Mock.new
md.expect(:find_user_groups, [], %w[john])
@posix.member_service = md
Expand Down