Skip to content

Commit

Permalink
Update demo cluster config
Browse files Browse the repository at this point in the history
  • Loading branch information
tleyden committed Feb 1, 2016
1 parent 051e1d7 commit 84b333c
Showing 1 changed file with 23 additions and 67 deletions.
90 changes: 23 additions & 67 deletions examples/democlusterconfig.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,42 @@
{
"log":["REST", "Shadow", "CRUD", "CRUD+", "HTTP", "HTTP+", "Access", "Changes", "Changes+","Auth", "SSL"],
"maxFileDescriptors": 50000,
"facebook" : {
"register" : true
},
"databases": {
"officeradar": {
"server":"http://172.23.121.42:8091",
"bucket":"officeradar",
"users": {
"GUEST": {"disabled": false, "all_channels": ["*"], "admin_channels": ["*"]}
}
},
"gaggle": {
"server":"http://172.23.121.42:8091",
"server":"http://172.23.121.38:8091",
"bucket":"gaggle",
"users": {
"GUEST": {"disabled": false, "admin_channels": ["*"]}
"GUEST": {"disabled": false, "admin_channels": ["*"]}
}
},
"chess-park": {
"server":"http://172.23.121.42:8091",
"bucket":"chess-park",
"sync":`
function(doc, oldDoc){
log("sync function enter as log")
if (doc.type == "match") {
log("processing match");
if (doc._deleted) {
// only owners can delete
requireUser(oldDoc.ownerId);
} else {
if (doc.status == "active") {
requireUser([doc.ownerId, doc.opponentId]);
channel("games-" + doc.ownerId);
channel("games-" + doc.opponentId);
} else if (doc.status == "waiting") {
channel("games-waiting");
}
}
} else if (doc.type == "userProfile") {
log("processing user profile");
// only users can update their user profile
requireUser(doc.userId);

// for now, only users can see their profiles (no friend support)
channel("userprofile-" + doc.userId);

// if a profile is present, grant them access to their own games channel
access(doc.userId, "userprofile-" + doc.userId);
access(doc.userId, "games-" + doc.userId);
access(doc.userId, "games-waiting");
} else {
channel(doc.channels);
}
}
`
},
"connect2014": {
"server":"http://172.23.121.42:8091",
"server":"http://172.23.121.38:8091",
"bucket":"connect2014",
"users": {
"GUEST": {"disabled": true}
"GUEST": {"disabled": true}
},
"sync":
`
function(doc, oldDoc){

if (doc.type == "contact") {
// Users can't assign their contact document to another user.
if (oldDoc != null && oldDoc.userId != doc.userId) throw({forbidden: "Can't change userId."});
if (oldDoc != null && oldDoc.userId != doc.userId) throw({forbidden: "Can't change userId."});
// Users can only change their own contact.
requireUser(oldDoc == null ? doc.userId : oldDoc.userId);

} else if (doc.type == "contactexchange") {
// Can't modify a contact exchange document.
if (oldDoc != null) throw({forbidden: "Can't modify a contact exchange document."});
if (oldDoc != null) throw({forbidden: "Can't modify a contact exchange document."});
// Issuing user must be the local user.
requireUser(doc.localUserId);

} else if (doc.type == "surveyresult") {
// Can't modify a conference survey document.
if (oldDoc != null) throw({forbidden: "Can't modify a conference survey document."});
if (oldDoc != null) throw({forbidden: "Can't modify a conference survey document."});
// Extract the userId from the document _id (the format of _id is "surveyresult-USER-ID").
var userId = doc._id.substring(13);
// Users can only create their own conference survey.
Expand Down Expand Up @@ -122,9 +78,9 @@
access(doc.localUserId, "contact-" + doc.userId);
}

if (doc.type == "session" ||
doc.type == "speaker" ||
doc.type == "schedule" ||
if (doc.type == "session" ||
doc.type == "speaker" ||
doc.type == "schedule" ||
doc.type == "appconfig" ||
doc.type == "scavengerhuntitem" ) {

Expand All @@ -135,30 +91,30 @@
`
},
"connect2015": {
"server":"http://172.23.121.42:8091",
"server":"http://172.23.121.38:8091",
"bucket":"connect2015",
"users": {
"GUEST": {"disabled": true}
"GUEST": {"disabled": true}
},
"sync":
`
function(doc, oldDoc){

if (doc.type == "contact") {
// Users can't assign their contact document to another user.
if (oldDoc != null && oldDoc.userId != doc.userId) throw({forbidden: "Can't change userId."});
if (oldDoc != null && oldDoc.userId != doc.userId) throw({forbidden: "Can't change userId."});
// Users can only change their own contact.
requireUser(oldDoc == null ? doc.userId : oldDoc.userId);

} else if (doc.type == "contactexchange") {
// Can't modify a contact exchange document.
if (oldDoc != null) throw({forbidden: "Can't modify a contact exchange document."});
if (oldDoc != null) throw({forbidden: "Can't modify a contact exchange document."});
// Issuing user must be the local user.
requireUser(doc.localUserId);

} else if (doc.type == "surveyresult") {
// Can't modify a conference survey document.
if (oldDoc != null) throw({forbidden: "Can't modify a conference survey document."});
if (oldDoc != null) throw({forbidden: "Can't modify a conference survey document."});
// Extract the userId from the document _id (the format of _id is "surveyresult-USER-ID").
var userId = doc._id.substring(13);
// Users can only create their own conference survey.
Expand Down Expand Up @@ -200,9 +156,9 @@
access(doc.localUserId, "contact-" + doc.userId);
}

if (doc.type == "session" ||
doc.type == "speaker" ||
doc.type == "schedule" ||
if (doc.type == "session" ||
doc.type == "speaker" ||
doc.type == "schedule" ||
doc.type == "appconfig" ||
doc.type == "scavengerhuntitem" ) {

Expand All @@ -213,19 +169,19 @@
`
},
"grocery-sync": {
"server":"http://172.23.121.42:8091",
"server":"http://172.23.121.38:8091",
"bucket":"grocery-sync",
"users": {
"GUEST": {"disabled": false, "all_channels": ["*"], "admin_channels": ["*"]}
"GUEST": {"disabled": false, "all_channels": ["*"], "admin_channels": ["*"]}
}
},
"todolite": {
"server":"http://172.23.121.42:8091",
"server":"http://172.23.121.38:8091",
"bucket":"todolite",
"users": {
"GUEST": {"disabled": true}
},
"sync":
"sync":
`
function(doc, oldDoc) {
// NOTE this function is the same across the iOS, Android, and PhoneGap versions.
Expand Down

0 comments on commit 84b333c

Please sign in to comment.