gerardobort/mongorilla — pull request #11 by ivanmayes (2014-09-17 22:45:58+00:00)
Title: Schema conditionals / permissions

Added two new features for the schema JSON, conditionals and permissions.

Conditionals:
Change Values or remove a property based on page or role. You can change any property or remove the field based on the page you are on, or the role your user is.

Example:
"password": {
"type": "Select",
"title": "Roles",
"options": ["admin", "editor"],
"conditionals": [
{
// This conditional will only work when creating an item when this value is set. 'create' or 'edit'
"page": "create",
// This conditional will only work for the roles in this array when this value is set
"roles": ["admin"],
"remove":true, // Removes this field when conditions are met
"props": {
"options": ["super_admin"]
}
}
]
}

Permissions:
Lets you set which roles can see this field (whereas the 'remove' feature on conditionals is about hiding for certain roles).

Example:
"password": {
"type": "Password",
"title": "Password",
"permissions": ["admin", "editor"]
}