File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1432,14 +1432,16 @@ class DatabaseController {
1432
1432
)
1433
1433
return null ;
1434
1434
1435
- let protectedKeys ;
1436
- [ ... ( auth . userRoles || [ ] ) , '*' ] . forEach ( role => {
1437
- // If you are in multiple groups assign the role with the least protectedKeys.
1438
- // Technically this could fail if multiple roles protect different fields and produce the same count.
1439
- // But we have no way of knowing the role hierarchy here.
1435
+ let protectedKeys = Object . values ( protectedFields ) . reduce (
1436
+ ( acc , val ) => acc . concat ( val ) ,
1437
+ [ ]
1438
+ ) ; //.flat();
1439
+ [ ... ( auth . userRoles || [ ] ) ] . forEach ( role => {
1440
1440
const fields = protectedFields [ role ] ;
1441
- if ( fields && ( ! protectedKeys || fields . length < protectedKeys . length ) ) {
1442
- protectedKeys = fields ;
1441
+ if ( fields ) {
1442
+ protectedKeys = protectedKeys . filter (
1443
+ value => - 1 !== fields . indexOf ( value )
1444
+ ) ;
1443
1445
}
1444
1446
} ) ;
1445
1447
You can’t perform that action at this time.
0 commit comments