Skip to content

Commit 6940edc

Browse files
committed
Mark embedded permissions as enumberable
This way, when you serialize a plain object that has the embedded permissions, it will get serialized for you.
1 parent 69c09e0 commit 6940edc

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

__tests__/embedPermissions.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,5 @@ test('Verify that the permissions data cannot be changed', (t) => {
135135
'The permissions field should not be writable',
136136
);
137137
});
138+
139+
test.todo('Make sure enumerable is set to true for the embedded permissions');

src/embedPermissions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function embedPermissions(schema, options, authLevels, doc) {
2020
remove: hasPermission(schema, authLevels, 'remove'),
2121
},
2222
writable: false,
23+
enumerable: true,
2324
});
2425

2526
// Freeze the object so this data can't be altered (even accidentally)

0 commit comments

Comments
 (0)