@saltcorn/mobile-app 0.9.5-beta.6 → 0.9.5-beta.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saltcorn/mobile-app",
3
3
  "displayName": "Saltcorn mobile app",
4
- "version": "0.9.5-beta.6",
4
+ "version": "0.9.5-beta.7",
5
5
  "description": "Apache Cordova application with @saltcorn/markup",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -37,8 +37,12 @@ const findPageOrGroup = (pagename) => {
37
37
  };
38
38
 
39
39
  const runPage = async (page, state, context, { req, res }) => {
40
- if (state.mobileConfig.role_id > page.min_role)
41
- throw new saltcorn.data.utils.NotAuthorized(req.__("Not authorized"));
40
+ if (state.mobileConfig.role_id > page.min_role) {
41
+ const additionalInfos = `: your role: ${state.mobileConfig.role_id}, page min_role: ${page.min_role}`;
42
+ throw new saltcorn.data.utils.NotAuthorized(
43
+ req.__("Not authorized") + additionalInfos
44
+ );
45
+ }
42
46
  const query = parseQuery(context.query);
43
47
  return await page.run(query, { req, res });
44
48
  };
@@ -61,8 +65,12 @@ const getEligiblePage = async (pageGroup, req) => {
61
65
  };
62
66
 
63
67
  const runPageGroup = async (pageGroup, state, context, { req, res }) => {
64
- if (state.mobileConfig.role_id > pageGroup.min_role)
65
- throw new saltcorn.data.utils.NotAuthorized(req.__("Not authorized"));
68
+ if (state.mobileConfig.role_id > pageGroup.min_role) {
69
+ const additionalInfos = `: your role: ${state.mobileConfig.role_id}, pagegroup min_role: ${pageGroup.min_role}`;
70
+ throw new saltcorn.data.utils.NotAuthorized(
71
+ req.__("Not authorized") + additionalInfos
72
+ );
73
+ }
66
74
  const page = await getEligiblePage(pageGroup, req);
67
75
  if (!page)
68
76
  throw new Error(req.__(`Pagegroup ${pageGroup.name} has no eligible page`));
@@ -131,8 +131,12 @@ const getView = async (context) => {
131
131
  if (
132
132
  state.mobileConfig.role_id > view.min_role &&
133
133
  !(await view.authorise_get({ query, req, ...view }))
134
- )
135
- throw new saltcorn.data.utils.NotAuthorized(req.__("Not authorized"));
134
+ ) {
135
+ const additionalInfos = `: your role: ${state.mobileConfig.role_id}, view min_role: ${view.min_role}`;
136
+ throw new saltcorn.data.utils.NotAuthorized(
137
+ req.__("Not authorized") + additionalInfos
138
+ );
139
+ }
136
140
  const contents = await view.run_possibly_on_page(
137
141
  query,
138
142
  req,