Fixes problem where the sensitive value placeholder was being posted back to the server for saving, instead we don't post this value at all which means it will not be overwritten when it posts back.
This commit is contained in:
@@ -304,14 +304,14 @@
|
||||
_.each(tab.properties, function (prop) {
|
||||
|
||||
//don't include the custom generic tab properties
|
||||
if (!prop.alias.startsWith("_umb_")) {
|
||||
//don't include a property that is marked readonly
|
||||
if (!prop.alias.startsWith("_umb_") && !prop.readonly) {
|
||||
saveModel.properties.push({
|
||||
id: prop.id,
|
||||
alias: prop.alias,
|
||||
value: prop.value
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<div class="umb-editor umb-readonlyvalue">
|
||||
<em class="muted">{{model.value}}</em>
|
||||
<em class="muted">
|
||||
<localize key="content_isSensitiveValue">Hide this property value from content editors that don't have access to view sensitive information</localize>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[DataMember(Name = "validation")]
|
||||
public PropertyTypeValidation Validation { get; set; }
|
||||
|
||||
[DataMember(Name = "isSensitiveData")]
|
||||
public bool IsSensitive { get; set; }
|
||||
[DataMember(Name = "readonly")]
|
||||
public bool Readonly { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,14 +390,17 @@ namespace Umbraco.Web.Models.Mapping
|
||||
//now update the IsSensitive value
|
||||
foreach (var prop in result)
|
||||
{
|
||||
prop.IsSensitive = memberType.IsSensitiveProperty(prop.Alias);
|
||||
//check if this property is flagged as sensitive
|
||||
var isSensitiveProperty = memberType.IsSensitiveProperty(prop.Alias);
|
||||
//check permissions for viewing sensitive data
|
||||
if (prop.IsSensitive && umbracoContext.Security.CurrentUser.HasAccessToSensitiveData() == false)
|
||||
if (isSensitiveProperty && umbracoContext.Security.CurrentUser.HasAccessToSensitiveData() == false)
|
||||
{
|
||||
//mark this property as readonly so that it does not post any data
|
||||
prop.Readonly = true;
|
||||
//replace this editor with a sensitivevalue
|
||||
prop.View = "sensitivevalue";
|
||||
//replace the value
|
||||
prop.Value = _localizedTextService.Localize("content/isSensitiveValue");
|
||||
//clear the value
|
||||
prop.Value = null;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -125,8 +125,12 @@ namespace Umbraco.Web.WebApi.Filters
|
||||
continue;
|
||||
}
|
||||
|
||||
//get the posted value for this property
|
||||
var postedValue = postedItem.Properties.Single(x => x.Alias == p.Alias).Value;
|
||||
//get the posted value for this property, this may be null in cases where the property was marked as readonly which means
|
||||
//the angular app will not post that value.
|
||||
var postedProp = postedItem.Properties.FirstOrDefault(x => x.Alias == p.Alias);
|
||||
if (postedProp == null) continue;
|
||||
|
||||
var postedValue = postedProp.Value;
|
||||
|
||||
//get the pre-values for this property
|
||||
var preValues = p.PreValues;
|
||||
@@ -180,4 +184,4 @@ namespace Umbraco.Web.WebApi.Filters
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user