@galadrim/galadmin 0.1.146 → 0.1.148
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 +0 -8
- package/dist/api.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/api.ts +0 -11
- package/src/index.ts +1 -1
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -90,17 +90,6 @@ export default (db, config, user) => {
|
|
|
90
90
|
|
|
91
91
|
app.get('/config', async (req, res) => {
|
|
92
92
|
try {
|
|
93
|
-
config = {
|
|
94
|
-
...config,
|
|
95
|
-
...{
|
|
96
|
-
views: config.views.filter(view => !view.roles || view.roles.includes(user.role))
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
for (let view of config.views) {
|
|
100
|
-
if (view.columns) {
|
|
101
|
-
view.columns = view.columns.filter(column => !column.roles || column.roles.includes(user.role))
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
93
|
const { mysql, auth, sessionSecret, ...safeConfig } = config;
|
|
105
94
|
res.send({
|
|
106
95
|
config: serializeJs(safeConfig)
|
package/src/index.ts
CHANGED
|
@@ -157,7 +157,7 @@ export default (config: Config): any => {
|
|
|
157
157
|
)
|
|
158
158
|
.map(view => ({
|
|
159
159
|
...view,
|
|
160
|
-
...(view.type === "table" && view.canEdit !== false ? { canEdit: (req.session.user && view.roles.includes(req.session.user.role)) } : {}),
|
|
160
|
+
...(view.type === "table" && view.canEdit !== false ? { canEdit: (req.session.user && (!view.roles || view.roles.includes(req.session.user.role))) } : {}),
|
|
161
161
|
}))
|
|
162
162
|
}, req.session.user)(req, res, next)
|
|
163
163
|
})
|