Add role 'owner' to users (#185)

This commit is contained in:
Riccardo Graziosi
2023-01-18 21:11:27 +01:00
committed by GitHub
parent e86748edca
commit 0e96ff7ad4
25 changed files with 482 additions and 54 deletions

View File

@@ -7,11 +7,11 @@ tenant = Tenant.create(
Current.tenant = tenant
# Create an admin user and confirm its email automatically
admin = User.create(
owner = User.create(
full_name: 'Admin',
email: 'admin@example.com',
password: 'password',
role: 'admin',
role: 'owner',
confirmed_at: Time.zone.now
)
@@ -58,12 +58,12 @@ post1 = Post.create(
title: 'Users can submit feedback by publishing posts!',
description: 'You can assign a **status** to each post: this one, for example, is marked as "Planned". Remember that you can customise post statuses from Site settings > Statuses',
board_id: feature_board.id,
user_id: admin.id,
user_id: owner.id,
post_status_id: planned_post_status.id
)
PostStatusChange.create(
post_id: post1.id,
user_id: admin.id,
user_id: owner.id,
post_status_id: planned_post_status.id
)
@@ -71,17 +71,17 @@ post2 = Post.create(
title: 'There are multiple boards',
description: 'For now you have Feature Requests and Bug Reports, but you can add or remove as many as you want! Just go to Site settings > Boards!',
board_id: bug_board.id,
user_id: admin.id
user_id: owner.id
)
# # Create some comments
post1.comments.create(
body: 'Users can comment to express their opinions! As with posts and board descriptions, comments can be *Markdown* **formatted**',
user_id: admin.id
user_id: owner.id
)
# Let the user know how to log in with admin account
puts "A default tenant has been created with name #{tenant.site_name}"
puts 'A default admin account has been created. Credentials:'
puts "-> email: #{admin.email}"
puts "-> password: #{admin.password}"
puts "-> email: #{owner.email}"
puts "-> password: #{owner.password}"