@galadrim/galadmin 0.1.206 → 0.1.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -0
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/index.ts +2 -1
- package/src/types/config.ts +2 -1
package/dist/types/config.d.ts
CHANGED
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -212,7 +212,7 @@ export default (db, config, user) => {
|
|
|
212
212
|
customQuery: view.customQuery,
|
|
213
213
|
join: view.join,
|
|
214
214
|
selectExpression: view.selectExpression,
|
|
215
|
-
orderBy: req.body.orderBy || (view.subviews && req.body.subviewIndex !== undefined ? view.subviews[req.body.subviewIndex]?.orderBy : null) || view.orderBy,
|
|
215
|
+
orderBy: [req.body.orderBy || (view.subviews && req.body.subviewIndex !== undefined ? view.subviews[req.body.subviewIndex]?.orderBy : null) || view.orderBy, view.primaryId].filter(x => x).join(", "),
|
|
216
216
|
isDesc: req.body.isDesc === null ? view.isDesc : req.body.isDesc,
|
|
217
217
|
primaryId: view.primaryId,
|
|
218
218
|
query: req.body.query,
|
package/src/index.ts
CHANGED
|
@@ -84,7 +84,8 @@ export default (config: Config): any => {
|
|
|
84
84
|
res.send({ success: true })
|
|
85
85
|
} else if (config.authRoles) {
|
|
86
86
|
for (const authRole of config.authRoles) {
|
|
87
|
-
const
|
|
87
|
+
const filters = authRole.filters ? `AND ${authRole.filters}` : ""
|
|
88
|
+
const { rows } = await db.query(`SELECT * FROM ?? WHERE ?? = ? ${filters}`, [authRole.table, authRole.usernameField, req.body.username]);
|
|
88
89
|
let user;
|
|
89
90
|
for (const row of rows) {
|
|
90
91
|
if (await passwordMatch(req.body.password, row[authRole.passwordField])) {
|
package/src/types/config.ts
CHANGED
|
@@ -183,7 +183,7 @@ export type CustomAction = {
|
|
|
183
183
|
successMessage?: string;
|
|
184
184
|
isBulkAction?: boolean;
|
|
185
185
|
/**
|
|
186
|
-
* A callback that will be called after the action finishes successfully
|
|
186
|
+
* A callback that will be called after the action finishes successfully
|
|
187
187
|
* If set, the default success action will be ignored
|
|
188
188
|
* @param record The record the action was called on
|
|
189
189
|
* @param response The response from the action
|
|
@@ -406,6 +406,7 @@ export type AuthRole = {
|
|
|
406
406
|
usernameField: string;
|
|
407
407
|
passwordField: string;
|
|
408
408
|
idField: string;
|
|
409
|
+
filters?: string;
|
|
409
410
|
};
|
|
410
411
|
|
|
411
412
|
export type Config = {
|