Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLIBZ-1576: Kinvey V3 add acl to individual entity error #103

Merged
merged 6 commits into from Feb 6, 2017

Conversation

@thomasconner
Copy link
Contributor

commented Feb 1, 2017

Description

This PR fixes errors when trying to use Kinvey.Acl and Kinvey.Metadata with invalid objects.

Changes

  • Create an _acl property when a provided entity to Kinvey.Acl does not contain an _acl property.
  • Create an _kmd property when a provided entity to Kinvey.Metadata does not contain an _kmd property.
  • Don't default entities to an empty object for Kinvey.Acl and Kinvey.Metadata.
  • Update/Add related tests for Kinvey.Acl and Kinvey.Metadata.
thomasconner added 5 commits Feb 1, 2017
MLIBZ-1576 Fix acl constructor errors
Don't default entity argument to an empty object. Create an _acl property if the provided entity argument does not contain an _acl property.

@thomasconner thomasconner self-assigned this Feb 1, 2017

@codecov-io

This comment has been minimized.

Copy link

commented Feb 1, 2017

Codecov Report

Merging #103 into refactor will increase coverage by -0.01%.

@@             Coverage Diff              @@
##           refactor     #103      +/-   ##
============================================
- Coverage     73.54%   73.54%   -0.01%     
============================================
  Files            72       72              
  Lines          6679     6675       -4     
  Branches       1055     1053       -2     
============================================
- Hits           4912     4909       -3     
+ Misses         1767     1766       -1
Impacted Files Coverage Δ
src/entity/src/metadata.js 100% <100%> (ø)
src/entity/src/acl.js 100% <100%> (+0.7%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b533454...76d6c40. Read the comment docs.

@@ -24,7 +23,8 @@ export default class Acl {
* @private
* @type {Object}
*/
this.acl = cloneDeep(entity._acl);
entity._acl = entity._acl || {};
this.acl = entity._acl;

This comment has been minimized.

Copy link
@tejasranade

tejasranade Feb 3, 2017

Member

@thomasconner the Acl class seems to have an acl variable. Can we instead just have the properties directly on the instance?

This comment has been minimized.

Copy link
@thomasconner

thomasconner Feb 3, 2017

Author Contributor

No reason. Lets use your suggestion instead.

This comment has been minimized.

Copy link
@thomasconner

thomasconner Feb 3, 2017

Author Contributor

Fixed

@@ -19,7 +17,7 @@ export default class Metadata {
* @private
* @type {Object}
*/
this.kmd = cloneDeep(entity[kmdAttribute] || {});
this.kmd = entity._kmd || {};

This comment has been minimized.

Copy link
@tejasranade

tejasranade Feb 3, 2017

Member

Same comment as above. Do we need the kmd property?

This comment has been minimized.

Copy link
@thomasconner

thomasconner Feb 3, 2017

Author Contributor

Same as above

This comment has been minimized.

Copy link
@thomasconner

thomasconner Feb 3, 2017

Author Contributor

Fixed

@tejasranade
Copy link
Member

left a comment

LGTM

@thomasconner thomasconner merged commit 738d18e into refactor Feb 6, 2017

3 checks passed

codecov/patch 100% of diff hit (target 73.54%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +26.45% compared to b533454
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@thomasconner thomasconner deleted the MLIBZ-1576_ACL_Error branch Feb 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.