Sha256: b42677c7d537123099692d70f7982e71ebdc5b922360ca59d779f6ddcdad0350

Contents?: true

Size: 599 Bytes

Versions: 4

Compression:

Stored size: 599 Bytes

Contents

namespace :spree_roles do
  namespace :permissions do
    desc "Create admin username and password"
    task :populate => :environment do
      admin = Spree::Role.where(:name => 'admin').first_or_create!
      user = Spree::Role.where(:name => 'user').first_or_create!
      user.is_default = true
      user.save!

      permission1 = Spree::Permission.create!(:title => 'can-manage-all', :priority => 0)
      permission2 = Spree::Permission.create!(:title => 'default-permissions', :priority => 1)

      user.permissions = [permission2]
      admin.permissions = [permission1]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_admin_roles_and_access-1.2.1 lib/tasks/populate.rake
spree_admin_roles_and_access-1.2.0 lib/tasks/populate.rake
spree_admin_roles_and_access-1.1.0 lib/tasks/populate.rake
spree_admin_roles_and_access-1.0.0 lib/tasks/populate.rake