apostrophe-schemas
Advanced tools
Comparing version 0.5.85 to 0.5.86
@@ -714,2 +714,10 @@ /* jshint node:true */ | ||
schema = _.filter(schema, function(field) { | ||
if(!field.permission) { | ||
return true; | ||
} | ||
return self._apos.permissions.can(req, field.permission); | ||
}); | ||
// Allow alternate names for fields. Very useful when importing | ||
@@ -716,0 +724,0 @@ // from a previous schema. -Tom |
{ | ||
"version": "0.5.85", | ||
"version": "0.5.86", | ||
"name": "apostrophe-schemas", | ||
@@ -4,0 +4,0 @@ "description": "Schemas for easy editing of properties in Apostrophe objects", |
@@ -9,2 +9,4 @@ /* globals: async, apos, _, aposPages, async, $ */ | ||
self.populateFields = function($el, schema, snippet, callback) { | ||
schema = self.allowedSubset($el, schema); | ||
return async.eachSeries(schema, function(field, callback) { | ||
@@ -92,2 +94,4 @@ | ||
self.convertFields = function($el, schema, data, callback) { | ||
schema = self.allowedSubset($el, schema); | ||
self.findSafe($el, '[data-name]').removeClass('apos-error').removeClass('apos-error-required').removeClass('apos-error-in-advance').find('.apos-error-message').remove(); | ||
@@ -132,2 +136,18 @@ var failing; | ||
self.allowedSubset = function($el, schema) { | ||
return _.filter(schema, function(field) { | ||
if (!field.permission) { | ||
return true; | ||
} | ||
if(apos.data.permissions[field.permission] || apos.data.permissions.admin) { | ||
return true; | ||
} | ||
var $fieldset = self.findFieldset($el, field.name); | ||
$fieldset.addClass('apos-schemas-restricted'); | ||
return false; | ||
}); | ||
}; | ||
self.enableSingleton = function($el, name, area, type, optionsArg, callback) { | ||
@@ -134,0 +154,0 @@ if (typeof(optionsArg) === 'function') { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
124225
33
1873
1