|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Create users for local testing: regular, admin, and curator |
| 3 | + |
| 4 | +set -e |
| 5 | + |
| 6 | +echo "Creating roles (if they don't exist)..." |
| 7 | + |
| 8 | +# Create admin role if it doesn't exist |
| 9 | +invenio roles create admin 2>/dev/null || echo "Role 'admin' already exists" |
| 10 | + |
| 11 | +# Create curation moderation role if it doesn't exist |
| 12 | +invenio roles create administration-rdm-records-curation 2>/dev/null || echo "Role 'administration-rdm-records-curation' already exists" |
| 13 | + |
| 14 | +# Grant permissions to admin role |
| 15 | +echo "Granting permissions to admin role..." |
| 16 | +invenio access allow superuser-access role admin 2>/dev/null || echo "Permission already granted" |
| 17 | + |
| 18 | +echo "" |
| 19 | +echo "Creating users..." |
| 20 | + |
| 21 | +# Create regular user |
| 22 | +echo "Creating regular user: user@test.org (password: 123456)" |
| 23 | +invenio users create user@test.org --password 123456 --active --confirm 2>/dev/null || echo "User 'user@test.org' already exists" |
| 24 | + |
| 25 | +# Create admin user |
| 26 | +echo "Creating admin user: admin@test.org (password: 123456)" |
| 27 | +invenio users create admin@test.org --password 123456 --active --confirm 2>/dev/null || echo "User 'admin@test.org' already exists" |
| 28 | +invenio roles add admin@test.org admin 2>/dev/null || echo "Role already assigned" |
| 29 | + |
| 30 | +# Create curator user |
| 31 | +echo "Creating curator user: curator@test.org (password: 123456)" |
| 32 | +invenio users create curator@test.org --password 123456 --active --confirm 2>/dev/null || echo "User 'curator@test.org' already exists" |
| 33 | +invenio roles add curator@test.org administration-rdm-records-curation 2>/dev/null || echo "Role already assigned" |
| 34 | + |
| 35 | +echo "" |
| 36 | +echo "Users created successfully!" |
| 37 | +echo "" |
| 38 | +echo "Login credentials:" |
| 39 | +echo " Regular user: user@test.org / 123456" |
| 40 | +echo " Admin user: admin@test.org / 123456" |
| 41 | +echo " Curator user: curator@test.org / 123456" |
0 commit comments