@gandalan/weblibs 1.0.16 → 1.0.18
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/IDAS.js +32 -56
- package/package.json +1 -1
package/api/IDAS.js
CHANGED
|
@@ -30,42 +30,40 @@ class IDAS
|
|
|
30
30
|
this.restClient = new RESTClient(settings);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
claims = {
|
|
34
|
-
hasClaim(key) {
|
|
35
|
-
if (!authJwtToken) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
let decoded = jwt_decode(authJwtToken);
|
|
41
|
-
let val = decoded[key];
|
|
42
|
-
return val !== undefined;
|
|
43
|
-
// eslint-disable-next-line no-empty
|
|
44
|
-
} catch {}
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
getClaim(key) {
|
|
50
|
-
if (!authJwtToken) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
let decoded = jwt_decode(authJwtToken);
|
|
56
|
-
return decoded[key];
|
|
57
|
-
// eslint-disable-next-line no-empty
|
|
58
|
-
} catch {}
|
|
59
|
-
|
|
60
|
-
return;
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
|
|
64
33
|
auth = {
|
|
65
34
|
_self: this,
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
},
|
|
35
|
+
getCurrentAuthToken() {
|
|
36
|
+
return this._self.settings.jwtToken;
|
|
37
|
+
},
|
|
38
|
+
getRights() {
|
|
39
|
+
const token = this._self.settings.jwtToken;
|
|
40
|
+
if (!token)
|
|
41
|
+
return [];
|
|
42
|
+
const decoded = jwt_decode(authJwtToken);
|
|
43
|
+
return decoded.rights;
|
|
44
|
+
},
|
|
45
|
+
getRoles() {
|
|
46
|
+
const token = this._self.settings.jwtToken;
|
|
47
|
+
if (!token)
|
|
48
|
+
return [];
|
|
49
|
+
const decoded = jwt_decode(authJwtToken);
|
|
50
|
+
return decoded.role;
|
|
51
|
+
},
|
|
52
|
+
hasRight(code)
|
|
53
|
+
{
|
|
54
|
+
return this.getRights().some(r => r === code);
|
|
55
|
+
},
|
|
56
|
+
hasRole(code)
|
|
57
|
+
{
|
|
58
|
+
return this.getRoles().some(r => r === code);
|
|
59
|
+
},
|
|
60
|
+
getUsername() {
|
|
61
|
+
const token = this._self.settings.jwtToken;
|
|
62
|
+
if (!token)
|
|
63
|
+
return [];
|
|
64
|
+
const decoded = jwt_decode(authJwtToken);
|
|
65
|
+
return decoded.id;
|
|
66
|
+
}
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
mandanten = {
|
|
@@ -94,28 +92,6 @@ class IDAS
|
|
|
94
92
|
},
|
|
95
93
|
};
|
|
96
94
|
|
|
97
|
-
feedback = {
|
|
98
|
-
_self: this,
|
|
99
|
-
async getAll() {
|
|
100
|
-
return await this._self.restClient.get("/Feedback/");
|
|
101
|
-
},
|
|
102
|
-
async get(guid) {
|
|
103
|
-
return await this._self.restClient.get(`/Feedback/${guid}`);
|
|
104
|
-
},
|
|
105
|
-
async save(m) {
|
|
106
|
-
await this._self.restClient.put("/Feedback", m);
|
|
107
|
-
},
|
|
108
|
-
async comment(guid, commentData) {
|
|
109
|
-
await this._self.restClient.put(`/FeedbackKommentar/${guid}`, commentData);
|
|
110
|
-
},
|
|
111
|
-
async attachFile(guid, filename, data) {
|
|
112
|
-
await this._self.restClient.put(`/FeedbackAttachment/?feedbackGuid=${guid}&filename=${filename}`, data);
|
|
113
|
-
},
|
|
114
|
-
async deleteFile(guid) {
|
|
115
|
-
await this._self.restClient.delete(`/FeedbackAttachment/${guid}`);
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
95
|
rollen = {
|
|
120
96
|
_self: this,
|
|
121
97
|
async getAll() {
|