Sha256: 10af18ccf6bfa3f7c372ddf74e392d613f3a6ca2058352d223fa356c7d1f2fae
Contents?: true
Size: 1.17 KB
Versions: 13
Compression:
Stored size: 1.17 KB
Contents
module Sprinkle module Verifiers # = Permission and ownership Verifier # # Contains a verifier to check the permissions and ownership of a file or directory. # # == Example Usage # # verify { has_permission '/etc/apache2/apache2.conf', 0644 } # # verify { belongs_to_user '/etc/apache2/apache2.conf', 'noop' } # # verify { belongs_to_user '/etc/apache2/apache2.conf', 1000 } # module Permission Sprinkle::Verify.register(Sprinkle::Verifiers::Permission) def has_permission(path, permission) @commands << "find #{path} -maxdepth 0 -perm #{permission} | egrep '.*'" end def belongs_to_user(path, user) if user.is_a?(Integer) @commands << "find #{path} -maxdepth 0 -uid #{user} | egrep '.*'" else @commands << "find #{path} -maxdepth 0 -user #{user} | egrep '.*'" end end def belongs_to_group(path, group) if group.is_a?(Integer) @commands << "find #{path} -maxdepth 0 -gid #{group} | egrep '.*'" else @commands << "find #{path} -maxdepth 0 -group #{group} | egrep '.*'" end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems