Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
f4096934
Commit
f4096934
authored
Oct 20, 2011
by
Alexander Presber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose s3_permissions analoguous to s3_protocol
parent
3a6ca7d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
lib/paperclip/storage/s3.rb
+7
-3
No files found.
lib/paperclip/storage/s3.rb
View file @
f4096934
...
@@ -184,6 +184,12 @@ module Paperclip
...
@@ -184,6 +184,12 @@ module Paperclip
end
end
end
end
def
s3_permissions
(
style
=
default_style
)
s3_permissions
=
@s3_permissions
[
style
]
||
@s3_permissions
[
:default
]
s3_permissions
=
s3_permissions
.
call
(
self
,
style
)
if
s3_permissions
.
is_a?
(
Proc
)
s3_permissions
end
def
s3_protocol
(
style
=
default_style
)
def
s3_protocol
(
style
=
default_style
)
if
@s3_protocol
.
is_a?
(
Proc
)
if
@s3_protocol
.
is_a?
(
Proc
)
@s3_protocol
.
call
(
style
,
self
)
@s3_protocol
.
call
(
style
,
self
)
...
@@ -214,13 +220,11 @@ module Paperclip
...
@@ -214,13 +220,11 @@ module Paperclip
@queued_for_write
.
each
do
|
style
,
file
|
@queued_for_write
.
each
do
|
style
,
file
|
begin
begin
log
(
"saving
#{
path
(
style
)
}
"
)
log
(
"saving
#{
path
(
style
)
}
"
)
s3_permission
=
@s3_permissions
[
style
]
||
@s3_permissions
[
:default
]
s3_permission
=
s3_permission
.
call
(
self
,
style
)
if
s3_permission
.
is_a?
(
Proc
)
AWS
::
S3
::
S3Object
.
store
(
path
(
style
),
AWS
::
S3
::
S3Object
.
store
(
path
(
style
),
file
,
file
,
bucket_name
,
bucket_name
,
{
:content_type
=>
file
.
content_type
.
to_s
.
strip
,
{
:content_type
=>
file
.
content_type
.
to_s
.
strip
,
:access
=>
(
s3_permission
),
:access
=>
s3_permissions
(
style
),
}.
merge
(
@s3_headers
))
}.
merge
(
@s3_headers
))
rescue
AWS
::
S3
::
NoSuchBucket
=>
e
rescue
AWS
::
S3
::
NoSuchBucket
=>
e
create_bucket
create_bucket
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment