Sha256: b422a3e14285a5dc77a721887c1a74cdb4ccf0ccfe748a2f2e86810fd8069baa

Contents?: true

Size: 564 Bytes

Versions: 8

Compression:

Stored size: 564 Bytes

Contents

module Storytime
  class SitePolicy
    attr_reader :user, :site

    def initialize(user, site)
      @user = user
      @site = site
    end

    def manage?
      action = Storytime::Action.find_by(guid: "47342a")
      role = @user.storytime_role_in_site(Storytime::Site.current)
      role.present? && role.allowed_actions.include?(action)
    end

    def create?
      true # !Site.any?
    end

    def new?
      create?
    end

    def update?
      manage?
    end

    def edit?
      update?
    end

    def destroy?
      manage?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
storytime-2.1.6 app/policies/storytime/site_policy.rb
storytime-2.1.5 app/policies/storytime/site_policy.rb
storytime-2.1.4 app/policies/storytime/site_policy.rb
storytime-2.1.3 app/policies/storytime/site_policy.rb
storytime-2.1.2 app/policies/storytime/site_policy.rb
storytime-2.1.1 app/policies/storytime/site_policy.rb
storytime-2.1.0 app/policies/storytime/site_policy.rb
storytime-2.0.0 app/policies/storytime/site_policy.rb