-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
41 lines (41 loc) · 821 Bytes
/
test.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
var server = require("./index.js");
server.build({
models: {
user: {
defaults: {
id: 0,
name: "",
password: "",
perm: 1
},
session: true
},
incidence: {
defaults: {
id: 0,
owner: 0,
title: "",
permissionLevel: 2
},
crud: {
read: function (incidence, session) {
return session.perm > incidence.permissionLevel || session.id === incidence.owner;
},
create: function(incidence, session){
if(session.perm === 0){
incidence.owner = session.id
return incidence;
}
return false;
}
}
}
},
config: {
db: "./database",
rootdir: "public",
api: "rest",
verbosedb: true,
port: 8080
}
});