@@ -26,6 +26,12 @@ const hasAllPODobject = () => {
26
26
} ;
27
27
28
28
const defaultClassLevelPermissions = {
29
+ ACL : {
30
+ '*' : {
31
+ read : true ,
32
+ write : true ,
33
+ } ,
34
+ } ,
29
35
find : {
30
36
'*' : true ,
31
37
} ,
@@ -2058,12 +2064,70 @@ describe('schemas', () => {
2058
2064
} ,
2059
2065
} ) . then ( fail , response => {
2060
2066
expect ( response . data . error ) . toEqual (
2061
- "'1' is not a valid value for class level permissions find:*:1 "
2067
+ "'1' is not a valid value for class level permissions acl find:*"
2062
2068
) ;
2063
2069
done ( ) ;
2064
2070
} ) ;
2065
2071
} ) ;
2066
2072
2073
+ it ( 'should validate defaultAcl with class level permissions when request is not an object' , async ( ) => {
2074
+ const response = await request ( {
2075
+ method : 'POST' ,
2076
+ url : 'http://localhost:8378/1/schemas/AClass' ,
2077
+ headers : masterKeyHeaders ,
2078
+ json : true ,
2079
+ body : {
2080
+ classLevelPermissions : {
2081
+ ACL : {
2082
+ '*' : true ,
2083
+ } ,
2084
+ } ,
2085
+ } ,
2086
+ } ) . catch ( error => error . data ) ;
2087
+
2088
+ expect ( response . error ) . toEqual ( `'true' is not a valid value for class level permissions acl` ) ;
2089
+ } ) ;
2090
+
2091
+ it ( 'should validate defaultAcl with class level permissions when request is an object and invalid key' , async ( ) => {
2092
+ const response = await request ( {
2093
+ method : 'POST' ,
2094
+ url : 'http://localhost:8378/1/schemas/AClass' ,
2095
+ headers : masterKeyHeaders ,
2096
+ json : true ,
2097
+ body : {
2098
+ classLevelPermissions : {
2099
+ ACL : {
2100
+ '*' : {
2101
+ foo : true ,
2102
+ } ,
2103
+ } ,
2104
+ } ,
2105
+ } ,
2106
+ } ) . catch ( error => error . data ) ;
2107
+
2108
+ expect ( response . error ) . toEqual ( `'foo' is not a valid key for class level permissions acl` ) ;
2109
+ } ) ;
2110
+
2111
+ it ( 'should validate defaultAcl with class level permissions when request is an object and invalid value' , async ( ) => {
2112
+ const response = await request ( {
2113
+ method : 'POST' ,
2114
+ url : 'http://localhost:8378/1/schemas/AClass' ,
2115
+ headers : masterKeyHeaders ,
2116
+ json : true ,
2117
+ body : {
2118
+ classLevelPermissions : {
2119
+ ACL : {
2120
+ '*' : {
2121
+ read : 1 ,
2122
+ } ,
2123
+ } ,
2124
+ } ,
2125
+ } ,
2126
+ } ) . catch ( error => error . data ) ;
2127
+
2128
+ expect ( response . error ) . toEqual ( `'1' is not a valid value for class level permissions acl` ) ;
2129
+ } ) ;
2130
+
2067
2131
it ( 'should throw if permission is empty string' , done => {
2068
2132
request ( {
2069
2133
method : 'POST' ,
@@ -2079,7 +2143,7 @@ describe('schemas', () => {
2079
2143
} ,
2080
2144
} ) . then ( fail , response => {
2081
2145
expect ( response . data . error ) . toEqual (
2082
- " '' is not a valid value for class level permissions find:*:"
2146
+ ` '' is not a valid value for class level permissions acl find:*`
2083
2147
) ;
2084
2148
done ( ) ;
2085
2149
} ) ;
@@ -2690,6 +2754,12 @@ describe('schemas', () => {
2690
2754
setPermissionsOnClass (
2691
2755
'_Role' ,
2692
2756
{
2757
+ ACL : {
2758
+ '*' : {
2759
+ read : true ,
2760
+ write : true ,
2761
+ } ,
2762
+ } ,
2693
2763
get : { '*' : true } ,
2694
2764
find : { '*' : true } ,
2695
2765
count : { '*' : true } ,
@@ -2710,6 +2780,12 @@ describe('schemas', () => {
2710
2780
} )
2711
2781
. then ( res => {
2712
2782
expect ( res . data . classLevelPermissions ) . toEqual ( {
2783
+ ACL : {
2784
+ '*' : {
2785
+ read : true ,
2786
+ write : true ,
2787
+ } ,
2788
+ } ,
2713
2789
get : { '*' : true } ,
2714
2790
find : { '*' : true } ,
2715
2791
count : { '*' : true } ,
0 commit comments