Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow s3 permissions per style #398

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants
Contributor

lardawge commented Jan 25, 2011

Example:

    has_attached_file :image,
      :bucket => "testing",
      :path => ":attachment/:style/:basename.:extension"
      :s3_permissions => {
        :original => :private
      },
      :styles => {
        :thumb => '80x80>'
      }

The above will allow public read access on :thumb but require credentials for :original.

Example of setting default to private:

    has_attached_file :image,
      :bucket => "testing",
      :path => ":attachment/:style/:basename.:extension"
      :s3_permissions => :private
      :styles => {
        :thumb => '80x80>'
      }

The above will set all to private

Use case for me was the necessity to hide original images from public view.

jonn commented Mar 3, 2011

I have the same requirement (originals need to be private, all other styles not). Thanks for trying to get this back into master.

Contributor

sikachu commented Jun 23, 2011

This feature sound interesting. Do you mind rebasing your patch to the current code base, and force push to your branch?

Thank you.

Contributor

lardawge commented Jun 23, 2011

Yup, will do. Thanks.

Contributor

lardawge commented Jun 24, 2011

@sikachu, Had to do some refactoring to make it work with the current version of paperclip... Working and rebased.

I am also interested in this feature.

re5et commented Jun 29, 2011

I am also also interested in this feature.

Ability to set permissions on a per style bases.
Example:
  has_attached_file :image,
    :bucket => "testing",
    :path => ":attachment/:style/:basename.:extension"
    :s3_permissions => {
      :original => :private
    },
    :styles => {
      :thumb => '80x80>'
    }

The above will allow public read access on :thumb but require credentials for :original.

Example of setting default to private:
  has_attached_file :image,
    :bucket => "testing",
    :path => ":attachment/:style/:basename.:extension"
    :s3_permissions => :private
    :styles => {
      :thumb => '80x80>'
    }

The above will set all to private

@sikachu sikachu closed this in 5e86a99 Jun 29, 2011

Contributor

sikachu commented Jun 29, 2011

This has been merged. Thank you :)

re5et commented Jun 29, 2011

awesome, thanks

dosire added a commit to dosire/paperclip that referenced this pull request Feb 23, 2012

Ability to set permissions on a per style bases.
Example:
  has_attached_file :image,
    :bucket => "testing",
    :path => ":attachment/:style/:basename.:extension"
    :s3_permissions => {
      :original => :private
    },
    :styles => {
      :thumb => '80x80>'
    }

The above will allow public read access on :thumb but require credentials for :original.

Example of setting default to private:
  has_attached_file :image,
    :bucket => "testing",
    :path => ":attachment/:style/:basename.:extension"
    :s3_permissions => :private
    :styles => {
      :thumb => '80x80>'
    }

The above will set all to private

Closes #398
Conflicts:

	lib/paperclip/storage/s3.rb
	test/storage_test.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment