Sha256: e0c8e9ff501c3ef3ea1e5bd4ccc1d3366ede56f086c405f4a5abddfd554038ea

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

# Add default admin permission and role and normal user with no permissions
if Permission.count.zero? and Role.count.zero?
  # Create the admin permission.
  admin_permission = Permission.create!({
    :name => 'Administrator',
    :key => 'admin',
    :description => 'Administrative users have unrestricted access to all components within the application.',
    :locked => true
    }, :without_protection => true)

  # Create the manage users permission
  manage_users_permission = Permission.create!({
    :name => 'Manage Users',
    :key => 'manage_users',
    :description => 'Access to add, edit and remove application users.',
    :locked => true
    }, :without_protection => true)

  # Create the admin role
  admin_role = Role.create!({
    :name => 'Administrator',
    :description => 'Administrative users have unrestricted access to all components within the application.',
    :default_path => '/',
    :locked => true
    }, :without_protection => true)

  # Make sure admin role has the admin permission
  PermissionRole.create!({
    :role_id => admin_role.id,
    :permission_id => admin_permission.id
    }, :without_protection => true)


  # Make sure the admin role has the manage_users permission
  PermissionRole.create!({
    :role_id => admin_role.id,
    :permission_id => manage_users_permission.id
    }, :without_protection => true)

  # Set up the default user role, this role has no permissions.
  Role.create!({
    :name => 'Default',
    :description => 'Default users can log in to the application.',
    :default_path => '/'
    }, :without_protection => true)
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
challah-rolls-0.2.0 db/seeds.rb
challah-rolls-0.1.1 db/seeds.rb
challah-rolls-0.1.0 db/seeds.rb
challah-0.6.2 db/seeds.rb
challah-0.6.1 db/seeds.rb
challah-0.6.0 db/seeds.rb