Class: S3Secure::Policy::Checker
- Inherits:
-
Object
- Object
- S3Secure::Policy::Checker
- Defined in:
- lib/s3_secure/policy/checker.rb
Instance Method Summary collapse
- #has?(sid) ⇒ Boolean
-
#initialize(bucket_policy) ⇒ Checker
constructor
A new instance of Checker.
Constructor Details
#initialize(bucket_policy) ⇒ Checker
Returns a new instance of Checker.
3 4 5 |
# File 'lib/s3_secure/policy/checker.rb', line 3 def initialize(bucket_policy) @bucket_policy = bucket_policy # existing document policy end |
Instance Method Details
#has?(sid) ⇒ Boolean
7 8 9 10 11 12 13 |
# File 'lib/s3_secure/policy/checker.rb', line 7 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 |