Sha256: 5fe589ad7d4d9069eb9b8b82a3d435aa3ff4acd765399931d8eff8b852d8c439

Contents?: true

Size: 482 Bytes

Versions: 10

Compression:

Stored size: 482 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")
      @user.storytime_role.present? && @user.storytime_role.allowed_actions.include?(action)
    end

    def create?
      !Site.any?
    end

    def new?
      create?
    end

    def update?
      manage?
    end

    def edit?
      update?
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
storytime-1.2.0 app/policies/storytime/site_policy.rb
storytime-1.1.1 app/policies/storytime/site_policy.rb
storytime-1.0.7 app/policies/storytime/site_policy.rb
storytime-1.0.6 app/policies/storytime/site_policy.rb
storytime-1.0.5 app/policies/storytime/site_policy.rb
storytime-1.0.2 app/policies/storytime/site_policy.rb
storytime-1.0.1 app/policies/storytime/site_policy.rb
storytime-1.0.0 app/policies/storytime/site_policy.rb
storytime-0.0.4 app/policies/storytime/site_policy.rb
storytime-0.0.2 app/policies/storytime/site_policy.rb