Skip to content

Commit a4021e9

Browse files
committed
simplify config
closes #7
1 parent 19a507f commit a4021e9

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

src/templates/public/api.php

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,10 @@
3434
'middlewares' => 'dbAuth,authorization',
3535
'dbAuth.mode' => 'optional',
3636
'dbAuth.registerUser' => '1',
37-
'dbAuth.returnedColumns' => 'id,username',
38-
'authorization.tableHandler' => function ($operation, $tableName) {
39-
// Disallow user table for delete operations
40-
if ($operation === 'delete' && $tableName === 'users') {
41-
return false;
42-
}
43-
// No other table limitation
37+
'authorization.tableHandler' => function ($operation, $tableName) {
38+
if ($tableName === 'users') return false;
4439
return true;
45-
},
46-
'authorization.columnHandler' => function ($operation, $tableName, $columnName) {
47-
// Hide user/password column
48-
if (($operation === 'read' || $operation === 'list') && $tableName === 'users' && $columnName === 'password') {
49-
return false;
50-
}
51-
// No other column limitation
52-
return true;
53-
},
54-
'authorization.recordHandler' => function ($operation, $tableName) {
55-
// Limit user records to same user
56-
if ($tableName === 'users' && $operation !== 'create') {
57-
return 'filter=id,eq,' . USERID;
58-
}
59-
// No other record limitation
60-
return true;
61-
}
40+
}
6241

6342
]);
6443

0 commit comments

Comments
 (0)