@gandalan/weblibs 1.3.4 → 1.3.5
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/api/fluentAuthManager.js +18 -0
- package/package.json +1 -1
package/api/fluentAuthManager.js
CHANGED
|
@@ -199,6 +199,24 @@ export function createAuthManager() {
|
|
|
199
199
|
return res.ok ? await res.json() : null;
|
|
200
200
|
},
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* check if the user has the specific right
|
|
204
|
+
* @param {string} code
|
|
205
|
+
* @returns {boolean}
|
|
206
|
+
*/
|
|
207
|
+
hasRight(code) {
|
|
208
|
+
return (this.userInfo?.rights || []).includes(code);
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* check if the user has the specific role
|
|
213
|
+
* @param {string} code
|
|
214
|
+
* @returns {boolean}
|
|
215
|
+
*/
|
|
216
|
+
hasRole(code) {
|
|
217
|
+
return (this.userInfo?.role || []).includes(code);
|
|
218
|
+
},
|
|
219
|
+
|
|
202
220
|
/**
|
|
203
221
|
* update the user session with the new token
|
|
204
222
|
* @private
|