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

Fix setting ACL if they had been set before #230

Merged
merged 2 commits into from
Sep 27, 2018
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
20 changes: 18 additions & 2 deletions lib/puppet/provider/openldap_access/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def self.prefetch(resources)
if provider = accesses.find{ |access|
if resources[name][:position]
access.suffix == resources[name][:suffix] &&
access.position == resources[name][:position]
access.position == resources[name][:position].to_s
else
access.suffix == resources[name][:suffix] &&
access.access.flatten == resources[name][:access].flatten &&
Expand Down Expand Up @@ -105,7 +105,23 @@ def self.getDn(suffix)
def getDn(*args); self.class.getDn(*args); end

def exists?
@property_hash[:ensure] == :present
if resource[:position]
access = {
:suffix => resource[:suffix],
:position => resource[:position].to_s
}
else
access = {
:suffix => resource[:suffix],
:access => resource[:access].flatten,
:what => resource[:what]
}
end
accesses = self.class.instances.map { |acc|
acc_hash = acc.instance_variable_get(:@property_hash)
acc_hash.select { |k,v| access.key?(k) }
}
accesses.include?(access)
end

def create
Expand Down
10 changes: 10 additions & 0 deletions spec/acceptance/openldap__server__access_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ class { 'openldap::server': }
suffix => 'dc=example,dc=com',
require => Openldap::Server::Database['dc=example,dc=com'],
}
::openldap::server::access { 'root':
what => '*',
access => [
'by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth manage',
'by * break'
],
suffix => 'dc=example,dc=com',
position => 0,
require => Openldap::Server::Database['dc=example,dc=com'],
}
EOS

apply_manifest(pp, :catch_failures => true)
Expand Down