Sha256: 86d046f639ce4b489b34b05dd3fb5a2513c838d54a775809682d768679890ced

Contents?: true

Size: 536 Bytes

Versions: 23

Compression:

Stored size: 536 Bytes

Contents

# frozen_string_literal: true

class UserPolicy < Policy
  def index?
    true
  end

  def deactivated?
    index?
  end

  def new?
    User.none? || user.role?(:users)
  end

  def create?
    new?
  end

  def login?
    true
  end

  def manage?
    new?
  end

  def edit?
    user == record || user.role?(:users)
  end

  def show?
    edit?
  end

  def delete_image?
    edit?
  end

  def policies?
    user.role?(:users)
  end

  def destroy?
    user.role?(:users)
  end

  def change_password?
    user == record
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pages_core-3.13.0 app/policies/user_policy.rb
pages_core-3.12.7 app/policies/user_policy.rb
pages_core-3.12.6 app/policies/user_policy.rb
pages_core-3.12.5 app/policies/user_policy.rb
pages_core-3.12.4 app/policies/user_policy.rb
pages_core-3.12.3 app/policies/user_policy.rb
pages_core-3.12.2 app/policies/user_policy.rb
pages_core-3.12.1 app/policies/user_policy.rb
pages_core-3.12.0 app/policies/user_policy.rb
pages_core-3.11.3 app/policies/user_policy.rb
pages_core-3.11.2 app/policies/user_policy.rb
pages_core-3.11.1 app/policies/user_policy.rb
pages_core-3.11.0 app/policies/user_policy.rb
pages_core-3.10.2 app/policies/user_policy.rb
pages_core-3.10.1 app/policies/user_policy.rb
pages_core-3.9.2 app/policies/user_policy.rb
pages_core-3.9.1 app/policies/user_policy.rb
pages_core-3.9.0 app/policies/user_policy.rb
pages_core-3.8.3 app/policies/user_policy.rb
pages_core-3.8.2 app/policies/user_policy.rb