Sha256: 2fc652a74adbcfd026baadbc0b790f03ca441f1fff1744fd18457fc3b68e968a

Contents?: true

Size: 376 Bytes

Versions: 3

Compression:

Stored size: 376 Bytes

Contents

module S3Secure::Policy
  class Checker
    def initialize(bucket_policy)
      @bucket_policy = bucket_policy # existing document policy
    end

    def has?(sid)
      return false if @bucket_policy.blank?

      policy_document = JSON.load(@bucket_policy)
      statements = policy_document["Statement"]
      !!statements.detect { |s| s["Sid"] == sid }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
s3-secure-0.7.0 lib/s3_secure/policy/checker.rb
s3-secure-0.6.1 lib/s3_secure/policy/checker.rb
s3-secure-0.6.0 lib/s3_secure/policy/checker.rb