@vc-shell/framework 1.0.185 → 1.0.186

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.0.186](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.185...v1.0.186) (2024-03-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * administrator full access on permissions check ([9f96645](https://github.com/VirtoCommerce/vc-shell/commit/9f96645ae03c0920e83d2a8ecca5b3f565a910b9))
7
+
8
+
9
+
1
10
  ## [1.0.185](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.184...v1.0.185) (2024-03-15)
2
11
 
3
12
 
@@ -13,7 +13,7 @@ export function usePermissions(): IUsePermissions {
13
13
  }
14
14
 
15
15
  function hasAccess(permissions: string | string[] | undefined) {
16
- if (!permissions) {
16
+ if (!permissions || user.value?.isAdministrator) {
17
17
  return true;
18
18
  } else if (Array.isArray(permissions)) {
19
19
  return permissions.some((permission) => userPermissions.value.includes(permission));
@@ -51,7 +51,7 @@ export function registerInterceptors(router: Router) {
51
51
  /**
52
52
  * If the response is unauthorized, logout the user
53
53
  */
54
- if (response.status === 401 || (response.status === 500 && args[0] === "/api/vcmp/security/seller")) {
54
+ if (response.status === 401) {
55
55
  //logout user
56
56
  if (isAuthenticated.value) {
57
57
  signOut().then(() => {
package/dist/framework.js CHANGED
@@ -30210,14 +30210,13 @@ function Ec() {
30210
30210
  const { user: t } = Mn();
30211
30211
  t.value && (Df.value = t.value?.permissions ?? []);
30212
30212
  function e(r) {
30213
- if (r) {
30214
- if (Array.isArray(r))
30215
- return r.some((n) => Df.value.includes(n));
30216
- if (typeof r == "string")
30217
- return Df.value.includes(r);
30218
- throw new Error("Permissions must be a string or an array of strings");
30219
- } else
30213
+ if (!r || t.value?.isAdministrator)
30220
30214
  return !0;
30215
+ if (Array.isArray(r))
30216
+ return r.some((n) => Df.value.includes(n));
30217
+ if (typeof r == "string")
30218
+ return Df.value.includes(r);
30219
+ throw new Error("Permissions must be a string or an array of strings");
30221
30220
  }
30222
30221
  return {
30223
30222
  hasAccess: e
@@ -42337,7 +42336,7 @@ function I7(t) {
42337
42336
  });
42338
42337
  {
42339
42338
  const o = await e(...i);
42340
- return (o.status === 401 || o.status === 500 && i[0] === "/api/vcmp/security/seller") && n.value && r().then(() => {
42339
+ return o.status === 401 && n.value && r().then(() => {
42341
42340
  L7(t);
42342
42341
  }), o;
42343
42342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.185",
3
+ "version": "1.0.186",
4
4
  "type": "module",
5
5
  "main": "./dist/framework.js",
6
6
  "types": "./dist/index.d.ts",
@@ -55,9 +55,9 @@
55
55
  "whatwg-fetch": "^3.6.19"
56
56
  },
57
57
  "devDependencies": {
58
- "@vc-shell/api-client-generator": "^1.0.185",
59
- "@vc-shell/config-generator": "^1.0.185",
60
- "@vc-shell/ts-config": "^1.0.185",
58
+ "@vc-shell/api-client-generator": "^1.0.186",
59
+ "@vc-shell/config-generator": "^1.0.186",
60
+ "@vc-shell/ts-config": "^1.0.186",
61
61
  "@vitejs/plugin-vue": "^5.0.3",
62
62
  "sass": "^1.69.6",
63
63
  "shx": "^0.3.4",