Sha256: 7b0b3750cab52ffd1a35d24ffc1a28ba9b11fe1168bfe0e87361dcac50b9f7f9

Contents?: true

Size: 434 Bytes

Versions: 4

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

require 'ditty/policies/application_policy'

module Ditty
  class IdentityPolicy < ApplicationPolicy
    def register?
      true
    end

    def permitted_attributes
      %i[username password password_confirmation]
    end

    class Scope < ApplicationPolicy::Scope
      def resolve
        if user.super_admin?
          scope.all
        else
          []
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ditty-0.3.0 lib/ditty/policies/identity_policy.rb
ditty-0.2.2 lib/ditty/policies/identity_policy.rb
ditty-0.2.1 lib/ditty/policies/identity_policy.rb
ditty-0.2.0 lib/ditty/policies/identity_policy.rb