Sha256: 3d39f3e752efe5f48380372e10750dfd1722a9ed06c0c81abc4dfb07f941f4af

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

module Dummy
  class User < Kadmin::Auth::User
    def authorized?(_request)
      return true
    end
  end

  class UserStore < Kadmin::Auth::UserStore
    def get(email)
      set(email, Dummy::User.new(email))
      return super
    end

    def exists?(_email)
      true
    end
  end
end

Kadmin.config.logger = Rails.logger
Kadmin.config.mount_path = '/admin'

Kadmin::Auth.config.user_class = Dummy::User
Kadmin::Auth.config.user_store_class = Dummy::UserStore

Kadmin::Auth.config.enable!

Kadmin.config.handle_errors = !Rails.env.test?

Kadmin.config.add_navbar_items(
  Kadmin::Navbar::Section.new(
    id: Admin::PeopleController,
    text: 'People',
    links: [
      Kadmin::Navbar::Link.new(text: 'People list', path: -> (router) { router.admin_people_path }),
      Kadmin::Navbar::Link.new(text: 'Register new person', path: -> (router) { router.new_admin_person_path })
    ]
  ),
  Kadmin::Navbar::Section.new(
    id: Admin::GroupsController,
    text: 'Groups',
    links: [
      Kadmin::Navbar::Link.new(text: 'Groups list', path: -> (router) { router.admin_groups_path }),
      Kadmin::Navbar::Link.new(text: 'Add group', path: -> (router) { router.new_admin_group_path })
    ]
  )
)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kadmin-0.6.8 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.7 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.6 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.5 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.4 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.3 test/dummy/config/initializers/kadmin.rb
kadmin-0.6.1 test/dummy/config/initializers/kadmin.rb
kadmin-0.5.7 test/dummy/config/initializers/kadmin.rb
kadmin-0.5.6 test/dummy/config/initializers/kadmin.rb