Sha256: e917ec78beb541eee3ff3697f7fd40add9a8336bba6f9ee2b75ce531db04790f

Contents?: true

Size: 375 Bytes

Versions: 8

Compression:

Stored size: 375 Bytes

Contents

class 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

8 entries across 8 versions & 1 rubygems

Version Path
s3-secure-0.5.1 lib/s3_secure/policy/checker.rb
s3-secure-0.5.0 lib/s3_secure/policy/checker.rb
s3-secure-0.4.2 lib/s3_secure/policy/checker.rb
s3-secure-0.4.1 lib/s3_secure/policy/checker.rb
s3-secure-0.4.0 lib/s3_secure/policy/checker.rb
s3-secure-0.3.0 lib/s3_secure/policy/checker.rb
s3-secure-0.2.0 lib/s3_secure/policy/checker.rb
s3-secure-0.1.0 lib/s3_secure/policy/checker.rb