Sha256: 4400c022a9772178d32358a7db76fa330896289a32d25baf813daf0ae38090bf

Contents?: true

Size: 443 Bytes

Versions: 10

Compression:

Stored size: 443 Bytes

Contents

module Proclaim
	class ImagePolicy < ApplicationPolicy
		def cache?
			create?
		end

		def create?
			not @user.nil? # As long as there's a user, it can create images
		end

		def discard?
			destroy?
		end

		def destroy?
			not @user.nil? # As long as there's a user, it can destroy images
		end

		class Scope < Scope
			def resolve
				if @user
					scope.all # Users can access all images
				else
					nil
				end
			end
		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
proclaim-0.3.1 app/policies/proclaim/image_policy.rb
proclaim-0.3.0 app/policies/proclaim/image_policy.rb
proclaim-0.2.4 app/policies/proclaim/image_policy.rb
proclaim-0.2.2 app/policies/proclaim/image_policy.rb
proclaim-0.2.1 app/policies/proclaim/image_policy.rb
proclaim-0.2.0 app/policies/proclaim/image_policy.rb
proclaim-0.1.3 app/policies/proclaim/image_policy.rb
proclaim-0.1.2 app/policies/proclaim/image_policy.rb
proclaim-0.1.1 app/policies/proclaim/image_policy.rb
proclaim-0.1.0 app/policies/proclaim/image_policy.rb