4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bucket_client/aws/aws_policy_factory.rb', line 4
def generate_policy(access, key)
statements = []
if access === :public
uuid_2 = SecureRandom.uuid.to_s
policy_statement = {
"Sid": "AllowPublicRead#{uuid_2}",
"Action": ["s3:GetObject"],
"Effect": "Allow",
"Resource": "arn:aws:s3:::#{key}/*",
"Principal": "*"
}
statements.push policy_statement
end
uuid_1 = SecureRandom.uuid.to_s
{
"Id": "ReadPolicy#{uuid_1}",
"Version": "2012-10-17",
"Statement": statements
}
end
|