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) {
//
@ -24,4 +24,4 @@
// }
// });
// });
//};
// };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
{
"name": "story",
"base": "PersistedModel",
"trackChanges": false,
"idInjection": true,
"trackChanges": false,
"properties": {
"name": {
"type": "string",
@ -41,7 +41,9 @@
"type": "array",
"default": []
},
"author": {},
"author": {
"type": {}
},
"comments": {
"type": "array",
"default": []
@ -57,6 +59,26 @@
},
"validations": [],
"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": []
}

View File

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

View File

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