Sha256: c544587770ac129c48fb9a82cfcab6f5c07a40cc1ecedde79677fd0a721b8b9c

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 Bytes

Contents

class UserPolicy
  attr_reader :current_user, :user

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

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

  def index?
    manage?
  end

  def edit?
    manage?
  end

  def update?
    manage?
  end

  def new?
    manage?
  end

  def create?
    manage?
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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