Skip to content

Commit

Permalink
Fix updating relational field when the user has not permission to - #…
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Mar 21, 2017
1 parent e793e01 commit 49f52f2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/core/entries/EntriesModel.js
Expand Up @@ -2,12 +2,13 @@ define(function(require, exports, module) {

"use strict";

var app = require("app"),
Backbone = require("backbone"),
var app = require('app'),
_ = require('underscore'),
Backbone = require('backbone'),
ModelHelper = require('helpers/model'),
EntriesJunctionCollection = require("core/entries/EntriesJunctionCollection"),
UIManager = require("core/UIManager"),
SchemaManager = require("schema/SchemaManager");
EntriesJunctionCollection = require('core/entries/EntriesJunctionCollection'),
UIManager = require('core/UIManager'),
SchemaManager = require('schema/SchemaManager');

var nestedTypes = ['many_to_one', 'single_file'];

Expand Down Expand Up @@ -227,6 +228,7 @@ define(function(require, exports, module) {

var isModel,
isCollection,
self = this,
attributes = this.attributes;

if (method === 'patch' && options.includeRelationships) {
Expand All @@ -238,6 +240,9 @@ define(function(require, exports, module) {
var key = column.id;
var value = attributes[key];

// omit if the user has not permission to edit the field
if (!self.canEdit(key)) return;

// Some one-manys are not nested objects and will not need any special treatment
if (!_.isObject(value)) return;

Expand Down

1 comment on commit 49f52f2

@Zilus
Copy link

@Zilus Zilus commented on 49f52f2 Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!!

Please sign in to comment.