-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from natrontech/tidy
feat: enhance download of CSV for admin user
- Loading branch information
Showing
16 changed files
with
575 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
// add | ||
collection.schema.addField(new SchemaField({ | ||
"system": false, | ||
"id": "61gndav1", | ||
"name": "role", | ||
"type": "select", | ||
"required": false, | ||
"presentable": false, | ||
"unique": false, | ||
"options": { | ||
"maxSelect": 1, | ||
"values": [ | ||
"user", | ||
"admin" | ||
] | ||
} | ||
})) | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
// remove | ||
collection.schema.removeField("61gndav1") | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")\n" | ||
collection.viewRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")\n" | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && @request.auth.id = user.id" | ||
collection.viewRule = "@request.auth.id != \"\" && @request.auth.id = user.id" | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")" | ||
collection.viewRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")" | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")\n" | ||
collection.viewRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")\n" | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
// remove | ||
collection.schema.removeField("61gndav1") | ||
|
||
// add | ||
collection.schema.addField(new SchemaField({ | ||
"system": false, | ||
"id": "ntdnwymg", | ||
"name": "admin", | ||
"type": "bool", | ||
"required": false, | ||
"presentable": false, | ||
"unique": false, | ||
"options": {} | ||
})) | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
// add | ||
collection.schema.addField(new SchemaField({ | ||
"system": false, | ||
"id": "61gndav1", | ||
"name": "role", | ||
"type": "select", | ||
"required": false, | ||
"presentable": false, | ||
"unique": false, | ||
"options": { | ||
"maxSelect": 1, | ||
"values": [ | ||
"user", | ||
"admin" | ||
] | ||
} | ||
})) | ||
|
||
// remove | ||
collection.schema.removeField("ntdnwymg") | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.admin = true)" | ||
collection.viewRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.admin = true)" | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("frv5fa0d678jb4c") | ||
|
||
collection.listRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")" | ||
collection.viewRule = "@request.auth.id != \"\" && (@request.auth.id = user.id || @request.auth.role = \"admin\")" | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
collection.listRule = "id = @request.auth.id || @request.auth.admin = true" | ||
collection.viewRule = "id = @request.auth.id || @request.auth.admin = true" | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("_pb_users_auth_") | ||
|
||
collection.listRule = "id = @request.auth.id" | ||
collection.viewRule = "id = @request.auth.id" | ||
|
||
return dao.saveCollection(collection) | ||
}) |
Oops, something went wrong.