Sha256: 9c50e68b6b5b61b0b89d9f8214b6aaf871ef0ede107bd018ba5d62df723786ea

Contents?: true

Size: 605 Bytes

Versions: 10

Compression:

Stored size: 605 Bytes

Contents

module Imap; end

module Imap::Backup
  class Serializer::PermissionChecker
    attr_reader :filename
    attr_reader :limit

    def initialize(filename:, limit:)
      @filename = filename
      @limit = limit
    end

    def run
      actual = FileMode.new(filename: filename).mode
      return nil if actual.nil?

      mask = ~limit & 0o777
      return if (actual & mask).zero?

      message = format(
        "Permissions on '%<filename>s' " \
        "should be 0%<limit>o, not 0%<actual>o",
        filename: filename, limit: limit, actual: actual
      )
      raise message
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
imap-backup-13.1.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-13.0.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-12.1.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-12.0.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-11.1.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-11.1.0.rc1 lib/imap/backup/serializer/permission_checker.rb
imap-backup-11.0.1 lib/imap/backup/serializer/permission_checker.rb
imap-backup-11.0.0 lib/imap/backup/serializer/permission_checker.rb
imap-backup-11.0.0.rc1 lib/imap/backup/serializer/permission_checker.rb
imap-backup-10.0.1 lib/imap/backup/serializer/permission_checker.rb