add acl controls to models

This commit is contained in:
Berkeley Martinez
2015-06-10 23:59:42 -07:00
parent 147f1d1d37
commit af902799b1
10 changed files with 359 additions and 121 deletions

View File

@ -1,6 +1,6 @@
//var debug = require('debug')('freecc:models:userIdent'); // var debug = require('debug')('freecc:models:userIdent');
// //
//module.exports = function(UserIdent) { // module.exports = function(UserIdent) {
// //
// UserIdent.observe('before save', function(ctx, next) { // UserIdent.observe('before save', function(ctx, next) {
// //
@ -24,4 +24,4 @@
// } // }
// }); // });
// }); // });
//}; // };

View File

@ -1,23 +1,44 @@
{ {
"name": "bonfire", "name": "bonfire",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
"unique": true "unique": true
}, },
"difficulty": "string", "difficulty": {
"description": "array", "type": "string"
"tests": "array", },
"challengeSeed": "array", "description": {
"type": "array"
},
"tests": {
"type": "array"
},
"challengeSeed": {
"type": "array"
},
"MDNlinks": { "MDNlinks": {
"type": "array" "type": "array"
} }
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": [] "methods": []
} }

View File

@ -1,32 +1,77 @@
{ {
"name": "challenge", "name": "challenge",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
"unique": true "unique": true
}, },
"difficulty": "string", "difficulty": {
"description": "array", "type": "string"
"tests": "array", },
"challengeSeed": "array", "description": {
"challengeType": "string", "type": "array"
"MDNlinks": "array", },
"nameCn": "string", "tests": {
"descriptionCn": "array", "type": "array"
"nameFr": "string", },
"descriptionFr": "array", "challengeSeed": {
"nameRu": "string", "type": "array"
"descriptionRu": "array", },
"nameEs": "string", "challengeType": {
"descriptionEs": "array", "type": "string"
"namePt": "string", },
"descriptionPt": "array" "MDNlinks": {
"type": "array"
},
"nameCn": {
"type": "string"
},
"descriptionCn": {
"type": "array"
},
"nameFr": {
"type": "string"
},
"descriptionFr": {
"type": "array"
},
"nameRu": {
"type": "string"
},
"descriptionRu": {
"type": "array"
},
"nameEs": {
"type": "string"
},
"descriptionEs": {
"type": "array"
},
"namePt": {
"type": "string"
},
"descriptionPt": {
"type": "array"
}
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": [] "methods": []
} }

View File

@ -1,8 +1,8 @@
{ {
"name": "comment", "name": "comment",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"associatedPost": { "associatedPost": {
"type": "string", "type": "string",
@ -28,7 +28,9 @@
"type": "array", "type": "array",
"default": [] "default": []
}, },
"author": {}, "author": {
"type": {}
},
"comments": { "comments": {
"type": "array", "type": "array",
"default": [] "default": []
@ -40,6 +42,20 @@
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW",
"property": "create"
}
],
"methods": [] "methods": []
} }

View File

@ -1,8 +1,8 @@
{ {
"name": "fieldGuide", "name": "fieldGuide",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
@ -19,6 +19,19 @@
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": [] "methods": []
} }

View File

@ -1,17 +1,40 @@
{ {
"name": "job", "name": "job",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"position": "string", "position": {
"company": "string", "type": "string"
"logoUrl": "string", },
"postingUrl": "string", "company": {
"copy": "array" "type": "string"
},
"logoUrl": {
"type": "string"
},
"postingUrl": {
"type": "string"
},
"copy": {
"type": "array"
}
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": [] "methods": []
} }

View File

@ -1,30 +1,71 @@
{ {
"name": "nonprofit", "name": "nonprofit",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
"unique": true "unique": true
}, },
"requestedDeliverables": "array", "requestedDeliverables": {
"whatDoesNonprofitDo": "string", "type": "array"
"websiteLink": "string", },
"stakeholderName": "string", "whatDoesNonprofitDo": {
"stakeholderEmail": "string", "type": "string"
"endUser": "string", },
"approvedDeliverables": "array", "websiteLink": {
"projectDescription": "string", "type": "string"
"logoUrl": "string", },
"imageUrl": "string", "stakeholderName": {
"estimatedHours": "number", "type": "string"
"interestedCampers": [], },
"confirmedCampers": [], "stakeholderEmail": {
"currentStatus": "string" "type": "string"
},
"endUser": {
"type": "string"
},
"approvedDeliverables": {
"type": "array"
},
"projectDescription": {
"type": "string"
},
"logoUrl": {
"type": "string"
},
"imageUrl": {
"type": "string"
},
"estimatedHours": {
"type": "number"
},
"interestedCampers": {
"type": []
},
"confirmedCampers": {
"type": []
},
"currentStatus": {
"type": "string"
}
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": [] "methods": []
} }

View File

@ -1,8 +1,8 @@
{ {
"name": "story", "name": "story",
"base": "PersistedModel", "base": "PersistedModel",
"trackChanges": false,
"idInjection": true, "idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
@ -41,7 +41,9 @@
"type": "array", "type": "array",
"default": [] "default": []
}, },
"author": {}, "author": {
"type": {}
},
"comments": { "comments": {
"type": "array", "type": "array",
"default": [] "default": []
@ -57,6 +59,26 @@
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [], "acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW",
"property": "create"
}
],
"methods": [] "methods": []
} }

View File

@ -1,28 +1,42 @@
{ {
"name": "user", "name": "user",
"base": "User", "base": "User",
"trackChanges": false,
"idInjection": true,
"strict": true, "strict": true,
"idInjection": true,
"trackChanges": false,
"properties": { "properties": {
"email": { "email": {
"type": "string", "type": "string",
"lowercase": true,
"trim": true,
"index": { "index": {
"mongodb": { "mongodb": {
"unique": true, "unique": true,
"sparse": true "sparse": true
} }
} },
"lowercase": true,
"trim": true
},
"password": {
"type": "string"
},
"facebook": {
"type": "string"
},
"twitter": {
"type": "string"
},
"google": {
"type": "string"
},
"github": {
"type": "string"
},
"linkedin": {
"type": "string"
},
"tokens": {
"type": "array"
}, },
"password": "string",
"facebook": "string",
"twitter": "string",
"google": "string",
"github": "string",
"linkedin": "string",
"tokens": "array",
"progressTimestamps": { "progressTimestamps": {
"type": "array", "type": "array",
"default": [] "default": []
@ -108,32 +122,56 @@
"type": "string", "type": "string",
"default": "" "default": ""
}, },
"resetPasswordToken": "string", "resetPasswordToken": {
"sentSlackInvite": false, "type": "string"
"resetPasswordExpires": "string", },
"uncompletedBonfires": "array", "sentSlackInvite": {
"completedBonfires": [{ "type": {
"id": "string", "type": false
"name": "string", }
"completedWith": "string", },
"completedDate": "string", "resetPasswordExpires": {
"solution": "string" "type": "string"
}], },
"uncompletedCoursewares": "array", "uncompletedBonfires": {
"completedCoursewares": [{ "type": "array"
"completedDate": { },
"type": "string", "completedBonfires": {
"defaultFn": "now" "type": [
}, {
"id": "string", "id": "string",
"name": "string", "name": "string",
"completedWith": "string", "completedWith": "string",
"solution": "string", "completedDate": "string",
"githubLink": "string", "solution": "string"
"verified": "boolean" }
}], ]
"completedFieldGuides": [], },
"uncompletedFieldGuides": [], "uncompletedCoursewares": {
"type": "array"
},
"completedCoursewares": {
"type": [
{
"completedDate": {
"type": "string",
"defaultFn": "now"
},
"id": "string",
"name": "string",
"completedWith": "string",
"solution": "string",
"githubLink": "string",
"verified": "boolean"
}
]
},
"completedFieldGuides": {
"type": []
},
"uncompletedFieldGuides": {
"type": []
},
"currentStreak": { "currentStreak": {
"type": "number", "type": "number",
"default": 0 "default": 0
@ -142,8 +180,10 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"needsSomeDataModeled": { "type": "boolean", "default": false}, "needsSomeDataModeled": {
"type": "boolean",
"default": false
},
"needsMigration": { "needsMigration": {
"type": "boolean", "type": "boolean",
"default": true "default": true
@ -152,34 +192,50 @@
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"challengesHash": {}, "challengesHash": {
"currentChallenge": {}, "type": {}
},
"currentChallenge": {
"type": {}
},
"completedChallenges": { "completedChallenges": {
"type": [{ "type": [
"completedDate": "number", {
"id": "string", "completedDate": "number",
"name": "string", "id": "string",
"completedWith": "string", "name": "string",
"solution": "string", "completedWith": "string",
"githubLink": "string", "solution": "string",
"verified": "boolean", "githubLink": "string",
"challengeType": { "verified": "boolean",
"type": "number", "challengeType": {
"default": 0 "type": "number",
"default": 0
}
} }
}], ],
"default": [] "default": []
}, },
"uncompletedChallenges": "array" "uncompletedChallenges": {
"type": "array"
}
}, },
"validations": [], "validations": [],
"relations": {}, "relations": {},
"acls": [{ "acls": [
"accessType": "EXECUTE", {
"principalType": "ROLE", "accessType": "*",
"principalId": "$everyone", "principalType": "ROLE",
"permission": "ALLOW", "principalId": "$everyone",
"property": "doesExist" "permission": "DENY"
}], },
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW",
"property": "doesExist"
}
],
"methods": [] "methods": []
} }

View File

@ -4,6 +4,7 @@
"connector": "mongodb" "connector": "mongodb"
}, },
"mail": { "mail": {
"name": "mail",
"connector": "mail" "connector": "mail"
} }
} }