This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
dev_mongoinit.js
73 lines (67 loc) · 1.93 KB
/
dev_mongoinit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
db.createUser(
{
user: "amivapi",
pwd: "amivapi",
roles: [
{
role: "readWrite",
db: "amivapi"
}
]
}
);
db.getSiblingDB('test_amivapi').createUser(
{
user: "test_user",
pwd: "test_pw",
roles: [
{
role: "readWrite",
db: "test_amivapi"
}
]
}
);
// Use the following code to create default user, group and oauthclient for local development
// db = db.getSiblingDB('amivapi');
// // Create admin user with password admin
// let userId = db.users.insertOne({
// nethz: 'admin',
// password: '$pbkdf2-sha256$5$OqfUmtNaq5UyRohxDuGckw$9H/UL5N5dA7JmUq7ohRPfmJ84OUnpRKjTgsMeuFilXM',
// email: "[email protected]",
// membership: "regular",
// gender: "female",
// firstname: "ad",
// lastname: "min",
// _etag: "27f987fd9dd45d491e5aea3e27730israndom",
// }).insertedId;
// // Create admin group with permissions on all resources
// let groupId = db.groups.insertOne({
// name: 'admin',
// permissions: {
// apikeys: "readwrite",
// users: "readwrite",
// sessions: "readwrite",
// events: "readwrite",
// eventsignups: "readwrite",
// groups: "readwrite",
// groupmemberships: "readwrite",
// joboffers: "readwrite",
// beverages: "read",
// studydocuments: "readwrite",
// oauthclients: "readwrite",
// },
// _etag: "27f987fd9dd45d491e5aea3e27730israndom",
// }).insertedId;
// // Add admin to admin group
// db.groupmemberships.insertOne({
// user: userId,
// group: groupId,
// _etag: "27f987fd9dd45d491e5aea3e27730israndom",
// })
// // Add Local Tool client for admin tool
// db.oauthclients.insertOne({
// client_id: "Local Tool",
// redirect_uri: "http://localhost",
// _etag: "27f987fd9dd45d491e5aea3e27730israndom",
// });