Sha256: bb8aa7c53b6bba25dfcc8fba033dbaaacaeb92063fe88070ef34b9678b02f3d3

Contents?: true

Size: 1.42 KB

Versions: 33

Compression:

Stored size: 1.42 KB

Contents

default_site = ENV['DEFAULT_SITE'] || 'localhost'
admin_password = ENV['ADMIN_PWD'] || '123456'

admin_role = Role.find_or_create_by_name('admin')
site_role = Role.find_or_create_by_name(default_site)

user = User.create!(:login => 'admin', :email => "admin@example.com", :password => admin_password, :password_confirmation => admin_password)
user.roles << admin_role

admin_role.permissions.create!(:sequence => 0,
:action => 'edit', :resource_type => 'Topic', :resource => '*')
admin_role.permissions.create!(:sequence => 0,
:action => 'show', :resource_type => 'Wms', :resource => '*')
admin_role.permissions.create!(:sequence => 0,
:action => 'show', :resource_type => 'Wfs', :resource => '*')
admin_role.permissions.create!(:sequence => 0,
:action => 'edit', :resource_type => 'Layer', :resource => '*/*')
admin_role.permissions.create!(:sequence => 0,
:action => 'edit', :resource_type => 'Attribute', :resource => '*/*')

#Default tools
['LineMeasureTool', 'AreaMeasureTool', 'PrevTool', 'NextTool', 'LinkTool', 'PrintTool'].each_with_index do |tool, i|
  site_role.permissions.create!(:sequence => i,
  :action => 'show', :resource_type => 'Tool', :resource => "*/#{tool}")
end

#Basic permissions for default site
site_role.permissions.create!(:sequence => 0,
:action => 'index', :resource_type => 'Topic', :resource => '*')
site_role.permissions.create!(:sequence => 0,
:action => 'show', :resource_type => 'Attribute', :resource => '*/*')

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gb_mapfish_appserver-2.0.0 db/seeds.rb
gb_mapfish_appserver-1.1.1 db/seeds.rb
gb_mapfish_appserver-1.1.0 db/seeds.rb
gb_mapfish_appserver-1.0.6 db/seeds.rb
gb_mapfish_appserver-1.0.5 db/seeds.rb
gb_mapfish_appserver-1.0.4 db/seeds.rb
gb_mapfish_appserver-1.0.3 db/seeds.rb
gb_mapfish_appserver-1.0.2 db/seeds.rb
gb_mapfish_appserver-1.0.1 db/seeds.rb
gb_mapfish_appserver-1.0.0 db/seeds.rb
gb_mapfish_appserver-0.9.7 db/seeds.rb
gb_mapfish_appserver-0.9.6 db/seeds.rb
gb_mapfish_appserver-0.9.5 db/seeds.rb
gb_mapfish_appserver-0.9.4 db/seeds.rb
gb_mapfish_appserver-0.9.3 db/seeds.rb
gb_mapfish_appserver-0.9.2 db/seeds.rb
gb_mapfish_appserver-0.9.1 db/seeds.rb
gb_mapfish_appserver-0.9.0 db/seeds.rb
gb_mapfish_appserver-0.8.7 db/seeds.rb
gb_mapfish_appserver-0.8.6 db/seeds.rb