Skip to content

Commit

Permalink
feat: Add "count" to CLP initial value (parse-community#5841)
Browse files Browse the repository at this point in the history
* feat: count CLP default values

* fix tests
  • Loading branch information
douglasmuraoka authored and dplewis committed Jul 24, 2019
1 parent b4c19d6 commit 43d079f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/MongoSchemaCollectionAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('MongoSchemaCollection', () => {
_client_permissions: {
get: true,
find: true,
count: true,
update: true,
create: true,
delete: true,
Expand All @@ -19,6 +20,7 @@ describe('MongoSchemaCollection', () => {
class_permissions: {
get: { '*': true },
find: { '*': true },
count: { '*': true },
update: { '*': true },
create: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -69,6 +71,7 @@ describe('MongoSchemaCollection', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down
4 changes: 4 additions & 0 deletions spec/ParseLiveQueryServer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ describe('ParseLiveQueryServer', function() {
expect(saveArgs[0]).toBe('Yolo');
expect(saveArgs[3]).toEqual({
get: {},
count: {},
addField: {},
create: { '*': true },
find: {},
Expand All @@ -271,6 +272,7 @@ describe('ParseLiveQueryServer', function() {
expect(deleteArgs[0]).toBe('Yolo');
expect(deleteArgs[3]).toEqual({
get: {},
count: {},
addField: {},
create: { '*': true },
find: {},
Expand Down Expand Up @@ -1978,6 +1980,7 @@ describe('LiveQueryController', () => {
expect(saveArgs[0]).toBe('Yolo');
expect(saveArgs[3]).toEqual({
get: {},
count: {},
addField: {},
create: { '*': true },
find: {},
Expand All @@ -1992,6 +1995,7 @@ describe('LiveQueryController', () => {
expect(deleteArgs[0]).toBe('Yolo');
expect(deleteArgs[3]).toEqual({
get: {},
count: {},
addField: {},
create: { '*': true },
find: {},
Expand Down
8 changes: 8 additions & 0 deletions spec/Schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand All @@ -341,6 +342,7 @@ describe('SchemaController', () => {
const levelPermissions = {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -472,6 +474,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -787,6 +790,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -833,6 +837,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -865,6 +870,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -899,6 +905,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down Expand Up @@ -1088,6 +1095,7 @@ describe('SchemaController', () => {
classLevelPermissions: {
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down
6 changes: 6 additions & 0 deletions spec/schemas.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const defaultClassLevelPermissions = {
find: {
'*': true,
},
count: {
'*': true,
},
create: {
'*': true,
},
Expand Down Expand Up @@ -1160,6 +1163,7 @@ describe('schemas', () => {
'role:admin': true,
},
get: {},
count: {},
update: {},
delete: {},
addField: {},
Expand Down Expand Up @@ -2037,6 +2041,7 @@ describe('schemas', () => {
{
get: { '*': true },
find: { '*': true },
count: { '*': true },
create: { '*': true },
},
true
Expand All @@ -2056,6 +2061,7 @@ describe('schemas', () => {
expect(res.data.classLevelPermissions).toEqual({
get: { '*': true },
find: { '*': true },
count: { '*': true },
create: { '*': true },
update: {},
delete: {},
Expand Down
2 changes: 2 additions & 0 deletions src/Adapters/Storage/Mongo/MongoSchemaCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function mongoSchemaFieldsToParseSchemaFields(schema) {

const emptyCLPS = Object.freeze({
find: {},
count: {},
get: {},
create: {},
update: {},
Expand All @@ -67,6 +68,7 @@ const emptyCLPS = Object.freeze({

const defaultCLPS = Object.freeze({
find: { '*': true },
count: { '*': true },
get: { '*': true },
create: { '*': true },
update: { '*': true },
Expand Down
2 changes: 2 additions & 0 deletions src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const transformValue = value => {
const emptyCLPS = Object.freeze({
find: {},
get: {},
count: {},
create: {},
update: {},
delete: {},
Expand All @@ -112,6 +113,7 @@ const emptyCLPS = Object.freeze({
const defaultCLPS = Object.freeze({
find: { '*': true },
get: { '*': true },
count: { '*': true },
create: { '*': true },
update: { '*': true },
delete: { '*': true },
Expand Down

0 comments on commit 43d079f

Please sign in to comment.