@vc-shell/framework 1.0.83 → 1.0.85
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 +13 -0
- package/core/composables/useUser/index.ts +20 -8
- package/core/directives/index.ts +0 -1
- package/core/plugins/index.ts +1 -0
- package/core/plugins/permissions/index.ts +10 -0
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/core/directives/index.d.ts +0 -1
- package/dist/core/directives/index.d.ts.map +1 -1
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/index.d.ts.map +1 -1
- package/dist/core/plugins/permissions/index.d.ts +5 -0
- package/dist/core/plugins/permissions/index.d.ts.map +1 -0
- package/dist/framework.mjs +2799 -2805
- package/dist/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/core/directives/permissions/index.ts +0 -20
- package/dist/core/directives/permissions/index.d.ts +0 -3
- package/dist/core/directives/permissions/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [1.0.85](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.84...v1.0.85) (2023-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* check permissions plugin ([cc65272](https://github.com/VirtoCommerce/vc-shell/commit/cc65272d933e29f427b1403df2bdd627b15dd1e6))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [1.0.84](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.83...v1.0.84) (2023-06-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
1
14
|
## [1.0.83](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.82...v1.0.83) (2023-06-23)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, Ref, ref, ComputedRef } from "vue";
|
|
1
|
+
import { computed, Ref, ref, ComputedRef, getCurrentInstance, inject } from "vue";
|
|
2
2
|
import ClientOAuth2 from "client-oauth2";
|
|
3
3
|
import {
|
|
4
4
|
UserDetail,
|
|
@@ -48,6 +48,8 @@ interface IUseUser {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export function useUser(): IUseUser {
|
|
51
|
+
const instance = getCurrentInstance();
|
|
52
|
+
const base = instance && inject("platformUrl");
|
|
51
53
|
const externalSignInStorage = useLocalStorage<{ providerType: string }>("externalSignIn", { providerType: null });
|
|
52
54
|
|
|
53
55
|
const isAuthenticated = async () => {
|
|
@@ -112,8 +114,7 @@ export function useUser(): IUseUser {
|
|
|
112
114
|
console.debug(`[@vc-shell/framework#useUser:signOut] - Entry point`);
|
|
113
115
|
|
|
114
116
|
if (externalSignInStorage.value && externalSignInStorage.value.providerType) {
|
|
115
|
-
externalSignOut(externalSignInStorage.value.providerType);
|
|
116
|
-
externalSignInStorage.value = null;
|
|
117
|
+
externalSignOut(externalSignInStorage.value.providerType, window.location.pathname);
|
|
117
118
|
} else {
|
|
118
119
|
user.value = undefined;
|
|
119
120
|
authData.value = undefined;
|
|
@@ -247,9 +248,9 @@ export function useUser(): IUseUser {
|
|
|
247
248
|
return result;
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
async function externalSignIn(authenticationType: string
|
|
251
|
+
async function externalSignIn(authenticationType: string, returnUrl: string) {
|
|
251
252
|
try {
|
|
252
|
-
let url_ = "externalsignin?";
|
|
253
|
+
let url_ = base + "externalsignin?";
|
|
253
254
|
|
|
254
255
|
const signInData = {
|
|
255
256
|
providerType: authenticationType,
|
|
@@ -273,10 +274,21 @@ export function useUser(): IUseUser {
|
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
async function externalSignOut(authenticationType: string
|
|
277
|
+
async function externalSignOut(authenticationType: string, returnUrl: string): Promise<void> {
|
|
277
278
|
try {
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
let url_ = base + "externalsignin/signout?";
|
|
280
|
+
|
|
281
|
+
externalSignInStorage.value = null;
|
|
282
|
+
|
|
283
|
+
if (authenticationType === null) throw new Error("The parameter 'authenticationType' cannot be null.");
|
|
284
|
+
else {
|
|
285
|
+
if (authenticationType !== undefined)
|
|
286
|
+
url_ += "authenticationType=" + encodeURIComponent("" + authenticationType) + "&";
|
|
287
|
+
if (returnUrl !== undefined) url_ += "returnUrl=" + encodeURIComponent("" + returnUrl) + "&";
|
|
288
|
+
}
|
|
289
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
290
|
+
|
|
291
|
+
window.location.href = url_;
|
|
280
292
|
} catch (e) {
|
|
281
293
|
console.error(e);
|
|
282
294
|
throw e;
|
package/core/directives/index.ts
CHANGED
package/core/plugins/index.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { usePermissions } from "./../../composables";
|
|
2
|
+
import { App } from "vue";
|
|
3
|
+
|
|
4
|
+
export const permissions = {
|
|
5
|
+
install(app: App) {
|
|
6
|
+
const { checkPermission } = usePermissions();
|
|
7
|
+
app.config.globalProperties.$hasAccess = checkPermission;
|
|
8
|
+
app.provide("$hasAccess", checkPermission);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useUser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useUser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAA8B,MAAM,KAAK,CAAC;AAElF,OAAO,EACL,UAAU,EAGV,cAAc,EAEd,cAAc,EAGd,SAAS,EACT,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAY,qBAAqB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAiB/E,UAAU,QAAQ;I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Q,CAyQlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/plugins/permissions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAO,MAAM,WAAW;iBACT,GAAG;CAKjB,CAAC"}
|