mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fix(backend): register role seed (#337)
* adjust seed structure to support multiple projects * fix gitignore * seed the role a user has when registered properly
This commit is contained in:
parent
9a19617906
commit
0b77d95ae4
@ -13,7 +13,6 @@ npx directus-sync push \
|
|||||||
--directus-password admin123
|
--directus-password admin123
|
||||||
|
|
||||||
./seed.sh
|
./seed.sh
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pull Data from Docker to Harddrive
|
## Pull Data from Docker to Harddrive
|
||||||
@ -42,7 +41,6 @@ npx directus-sync push \
|
|||||||
|
|
||||||
In order to seed the development data, run the script `backend/seed.sh`.
|
In order to seed the development data, run the script `backend/seed.sh`.
|
||||||
|
|
||||||
|
|
||||||
## Backup Database
|
## Backup Database
|
||||||
|
|
||||||
Either keep a copy of the `/data/database` folder or run the following command to get an sql dump
|
Either keep a copy of the `/data/database` folder or run the following command to get an sql dump
|
||||||
|
|||||||
@ -1697,7 +1697,7 @@
|
|||||||
"permissions": null,
|
"permissions": null,
|
||||||
"validation": null,
|
"validation": null,
|
||||||
"presets": {
|
"presets": {
|
||||||
"role": "cccbc503-ecab-4ef1-8cf9-b6ac0f2be240"
|
"role": "REPLACEME-WITH-REGISTRATED-ROLE_UUID"
|
||||||
},
|
},
|
||||||
"fields": [
|
"fields": [
|
||||||
"first_name",
|
"first_name",
|
||||||
|
|||||||
@ -93,7 +93,7 @@
|
|||||||
"app_access": false,
|
"app_access": false,
|
||||||
"roles": [
|
"roles": [
|
||||||
{
|
{
|
||||||
"role": "9865ace7-27fe-4d1f-be88-99ee6410fca2",
|
"role": "role-registrated",
|
||||||
"sort": 1
|
"sort": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
"icon": "paragliding",
|
"icon": "paragliding",
|
||||||
"description": null,
|
"description": null,
|
||||||
"parent": null,
|
"parent": null,
|
||||||
"_syncId": "9865ace7-27fe-4d1f-be88-99ee6410fca2"
|
"_syncId": "role-registrated"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Editor",
|
"name": "Editor",
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# base setup
|
|
||||||
SCRIPT_PATH=$(realpath $0)
|
|
||||||
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
|
||||||
|
|
||||||
SEED_SQL_DIR=$SCRIPT_DIR/sql
|
|
||||||
|
|
||||||
# apply database updates
|
|
||||||
for filename in $SEED_SQL_DIR/*.sql; do
|
|
||||||
docker exec -i utopia-map-database-1 /bin/bash -c "PGPASSWORD=directus psql -v ON_ERROR_STOP=1 --username directus directus" < $filename
|
|
||||||
done
|
|
||||||
@ -1 +0,0 @@
|
|||||||
UPDATE public.directus_settings SET project_logo = (SELECT id FROM directus_files WHERE filename_download = 'utopia-logo.svg');
|
|
||||||
2
backend/directus-config/seeds/.gitignore
vendored
2
backend/directus-config/seeds/.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
*
|
/*
|
||||||
!development/
|
!development/
|
||||||
!.gitignore
|
!.gitignore
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
UPDATE public.directus_permissions
|
||||||
|
SET presets = jsonb_set(presets::jsonb,'{role}', to_jsonb((SELECT id FROM public.directus_roles WHERE name = 'Registrated')), true)
|
||||||
|
WHERE policy = (SELECT id FROM public.directus_policies WHERE name = '$t:public_label')
|
||||||
|
AND collection = 'directus_users'
|
||||||
|
AND action = 'create';
|
||||||
Loading…
x
Reference in New Issue
Block a user