info-library 2.14.13-beta.1 → 2.14.13-beta.2
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.
|
@@ -1051,48 +1051,86 @@ class InfoAuthenticationService {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
login(usuario, senha, reCaptchaToken = null, codigo2FA = null) {
|
|
1053
1053
|
this.removeSessao();
|
|
1054
|
-
return this.
|
|
1055
|
-
.post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/autenticar', { Usuario: usuario, Senha: senha, ReCaptchaToken: reCaptchaToken, Codigo2FA: codigo2FA })
|
|
1054
|
+
return this._dataService.postNoToken(this._plataforma.LoggedUserApi, { Usuario: usuario, Senha: senha, ReCaptchaToken: reCaptchaToken, Codigo2FA: codigo2FA }, 'Autenticar')
|
|
1056
1055
|
.pipe(map((r) => {
|
|
1057
|
-
if (r.
|
|
1058
|
-
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.
|
|
1059
|
-
return
|
|
1056
|
+
if (r.success && r.data != null)
|
|
1057
|
+
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.data.Token);
|
|
1058
|
+
return r;
|
|
1060
1059
|
}), catchError((e) => this.errorHandling(e)));
|
|
1060
|
+
// return this._http
|
|
1061
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/autenticar', { Usuario: usuario, Senha: senha, ReCaptchaToken: reCaptchaToken, Codigo2FA: codigo2FA })
|
|
1062
|
+
// .pipe(
|
|
1063
|
+
// map((r: any) => {
|
|
1064
|
+
// if (r.Success && r.Data != null)
|
|
1065
|
+
// this._utilities.setLocalStorage(this._plataforma.TokenKey, r.Data.Token);
|
|
1066
|
+
// return new InfoLoginModel(r.Success, r.Messages, r.Data);
|
|
1067
|
+
// }),
|
|
1068
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1069
|
+
// );
|
|
1061
1070
|
}
|
|
1062
1071
|
trocarEmpresa(usuario, empresaId) {
|
|
1063
|
-
return this.
|
|
1064
|
-
.post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/trocarempresa', { EmpresaId: empresaId }, { headers: this._dataService.getHeaderToken() })
|
|
1072
|
+
return this._dataService.post(this._plataforma.LoggedUserApi, { EmpresaId: empresaId }, 'TrocarEmpresa')
|
|
1065
1073
|
.pipe(map((r) => {
|
|
1066
|
-
if (r.
|
|
1067
|
-
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.
|
|
1068
|
-
return
|
|
1074
|
+
if (r.success && r.data != null)
|
|
1075
|
+
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.data);
|
|
1076
|
+
return r;
|
|
1069
1077
|
}), catchError((e) => this.errorHandling(e)));
|
|
1078
|
+
// this._http
|
|
1079
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/trocarempresa', { EmpresaId: empresaId }, { headers: this._dataService.getHeaderToken() })
|
|
1080
|
+
// .pipe(
|
|
1081
|
+
// map((r: any) => {
|
|
1082
|
+
// if (r.Success && r.Data != null)
|
|
1083
|
+
// this._utilities.setLocalStorage(this._plataforma.TokenKey, r.Data);
|
|
1084
|
+
// return new InfoLoginModel(r.Success, r.Messages, r.Data);
|
|
1085
|
+
// }),
|
|
1086
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1087
|
+
// );
|
|
1070
1088
|
}
|
|
1071
1089
|
trocarUnidade(usuario, empresaId, unidadeId) {
|
|
1072
|
-
return this.
|
|
1073
|
-
.post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/trocarunidade', { EmpresaId: empresaId, UnidadeId: unidadeId }, { headers: this._dataService.getHeaderToken() })
|
|
1090
|
+
return this._dataService.post(this._plataforma.LoggedUserApi, { EmpresaId: empresaId, UnidadeId: unidadeId }, 'TrocarUnidade')
|
|
1074
1091
|
.pipe(map((r) => {
|
|
1075
|
-
if (r.
|
|
1076
|
-
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.
|
|
1077
|
-
return
|
|
1092
|
+
if (r.success && r.data != null)
|
|
1093
|
+
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.data);
|
|
1094
|
+
return r;
|
|
1078
1095
|
}), catchError((e) => this.errorHandling(e)));
|
|
1096
|
+
// return this._http
|
|
1097
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/trocarunidade', { EmpresaId: empresaId, UnidadeId: unidadeId }, { headers: this._dataService.getHeaderToken() })
|
|
1098
|
+
// .pipe(
|
|
1099
|
+
// map((r: any) => {
|
|
1100
|
+
// if (r.Success && r.Data != null)
|
|
1101
|
+
// this._utilities.setLocalStorage(this._plataforma.TokenKey, r.Data);
|
|
1102
|
+
// return new InfoLoginModel(r.Success, r.Messages, r.Data);
|
|
1103
|
+
// }),
|
|
1104
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1105
|
+
// );
|
|
1079
1106
|
}
|
|
1080
1107
|
clonar(usuario) {
|
|
1081
|
-
return this.
|
|
1082
|
-
.post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/clonar', { Usuario: usuario }, { headers: this._dataService.getHeaderToken() })
|
|
1108
|
+
return this._dataService.post(this._plataforma.LoggedUserApi, { Usuario: usuario }, 'Clonar')
|
|
1083
1109
|
.pipe(map((r) => {
|
|
1084
|
-
if (r.
|
|
1085
|
-
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.
|
|
1086
|
-
return
|
|
1110
|
+
if (r.success && r.data != null)
|
|
1111
|
+
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.data);
|
|
1112
|
+
return r;
|
|
1087
1113
|
}), catchError((e) => this.errorHandling(e)));
|
|
1114
|
+
// return this._http
|
|
1115
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/clonar', { Usuario: usuario }, { headers: this._dataService.getHeaderToken() })
|
|
1116
|
+
// .pipe(
|
|
1117
|
+
// map((r: any) => {
|
|
1118
|
+
// if (r.Success && r.Data != null)
|
|
1119
|
+
// this._utilities.setLocalStorage(this._plataforma.TokenKey, r.Data);
|
|
1120
|
+
// return new InfoLoginModel(r.Success, r.Messages, r.Data);
|
|
1121
|
+
// }),
|
|
1122
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1123
|
+
// );
|
|
1088
1124
|
}
|
|
1089
1125
|
logout() {
|
|
1090
1126
|
if (this.isLogged()) {
|
|
1091
|
-
this.
|
|
1092
|
-
.subscribe(() => {
|
|
1127
|
+
this._dataService.post(this._plataforma.LoggedUserApi, 'Logout').subscribe(r => {
|
|
1093
1128
|
this.removeSessao();
|
|
1094
1129
|
this._router.navigateByUrl('login').then(r => { location.reload(); });
|
|
1095
1130
|
});
|
|
1131
|
+
// this._http.post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/Logout', null, { headers: this._dataService.getHeaderToken() })
|
|
1132
|
+
// .subscribe(() => {
|
|
1133
|
+
// });
|
|
1096
1134
|
}
|
|
1097
1135
|
else {
|
|
1098
1136
|
this.removeSessao();
|
|
@@ -1100,29 +1138,54 @@ class InfoAuthenticationService {
|
|
|
1100
1138
|
}
|
|
1101
1139
|
}
|
|
1102
1140
|
getPermissions(url, logAtividade = false) {
|
|
1103
|
-
return this.
|
|
1104
|
-
.
|
|
1105
|
-
|
|
1141
|
+
return this._dataService.get(this._plataforma.LoggedUserApi, 'GetPermissao', `url=${url}&logatividade=${logAtividade.toString()}`)
|
|
1142
|
+
.pipe(map((r) => r), catchError((e) => this.errorHandling(e)));
|
|
1143
|
+
// return this._http
|
|
1144
|
+
// .get(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/getpermissao?url=' + url + '&logatividade=' + logAtividade.toString(), { headers: this._dataService.getHeaderToken() })
|
|
1145
|
+
// .pipe(
|
|
1146
|
+
// map((r: any) => new InfoLoginModel(r.Success, r.Messages, r.Data)),
|
|
1147
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1148
|
+
// );
|
|
1106
1149
|
}
|
|
1107
1150
|
setTrocaSenha(model) {
|
|
1108
|
-
return this.
|
|
1109
|
-
.
|
|
1110
|
-
|
|
1151
|
+
return this._dataService.post(this._plataforma.LoggedUserApi, model, 'TrocarSenha')
|
|
1152
|
+
.pipe(map((r) => r), catchError((e) => this.errorHandling(e)));
|
|
1153
|
+
// return this._http
|
|
1154
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/TrocarSenha', model, { headers: this._dataService.getHeaderToken() })
|
|
1155
|
+
// .pipe(
|
|
1156
|
+
// map((r: any) => new InfoLoginModel(r.Success, r.Messages, r.Data)),
|
|
1157
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1158
|
+
// );
|
|
1111
1159
|
}
|
|
1112
1160
|
setRecuperarSenha(model) {
|
|
1113
|
-
return this.
|
|
1114
|
-
.
|
|
1115
|
-
|
|
1161
|
+
return this._dataService.post(this._plataforma.LoggedUserApi, model, 'RecuperarSenha')
|
|
1162
|
+
.pipe(map((r) => r), catchError((e) => this.errorHandling(e)));
|
|
1163
|
+
// return this._http
|
|
1164
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/RecuperarSenha', model, { headers: this._dataService.getHeaderToken() })
|
|
1165
|
+
// .pipe(
|
|
1166
|
+
// map((r: any) => new InfoLoginModel(r.Success, r.Messages, r.Data)),
|
|
1167
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1168
|
+
// );
|
|
1116
1169
|
}
|
|
1117
1170
|
setResetarSenha(model) {
|
|
1118
|
-
return this.
|
|
1119
|
-
.
|
|
1120
|
-
|
|
1171
|
+
return this._dataService.postNoToken(this._plataforma.LoggedUserApi, model, 'ResetarSenha')
|
|
1172
|
+
.pipe(map((r) => r), catchError((e) => this.errorHandling(e)));
|
|
1173
|
+
// return this._http
|
|
1174
|
+
// .post(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/ResetarSenha', model)
|
|
1175
|
+
// .pipe(
|
|
1176
|
+
// map((r: any) => new InfoLoginModel(r.Success, r.Messages, r.Data)),
|
|
1177
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1178
|
+
// );
|
|
1121
1179
|
}
|
|
1122
1180
|
getLoginResources() {
|
|
1123
|
-
return this.
|
|
1124
|
-
.
|
|
1125
|
-
|
|
1181
|
+
return this._dataService.getNoToken(this._plataforma.AppApi, 'GetLoginResources')
|
|
1182
|
+
.pipe(map((r) => r), catchError((e) => this.errorHandling(e)));
|
|
1183
|
+
// return this._http
|
|
1184
|
+
// .get(this._plataforma.Config.webapiUrl + this._plataforma.AppApi + '/GetLoginResources')
|
|
1185
|
+
// .pipe(
|
|
1186
|
+
// map((r: any) => new InfoLoginModel(r.Success, r.Messages, r.Data)),
|
|
1187
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1188
|
+
// );
|
|
1126
1189
|
}
|
|
1127
1190
|
hasPermission(url, keyFunction = 'view') {
|
|
1128
1191
|
if (url == '/' && keyFunction == 'view')
|
|
@@ -1175,9 +1238,14 @@ class InfoAuthenticationService {
|
|
|
1175
1238
|
}
|
|
1176
1239
|
}
|
|
1177
1240
|
validaSessao(url) {
|
|
1178
|
-
return this.
|
|
1179
|
-
.get(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/validasessao?url=' + url, { headers: this._dataService.getHeaderToken() })
|
|
1241
|
+
return this._dataService.get(this._plataforma.LoggedUserApi, 'ValidaSessao', `url=${url}`)
|
|
1180
1242
|
.pipe(map((r) => new InfoLoginModel(r === true, '', r)), catchError((e) => this.errorHandling(e)));
|
|
1243
|
+
// return this._http
|
|
1244
|
+
// .get(this._plataforma.Config.webapiUrl + this._plataforma.LoggedUserApi + '/validasessao?url=' + url, { headers: this._dataService.getHeaderToken() })
|
|
1245
|
+
// .pipe(
|
|
1246
|
+
// map((r: any) => new InfoLoginModel(r === true, '', r)),
|
|
1247
|
+
// catchError((e: HttpErrorResponse) => this.errorHandling(e))
|
|
1248
|
+
// );
|
|
1181
1249
|
}
|
|
1182
1250
|
removeSessao() {
|
|
1183
1251
|
Object.keys(localStorage).forEach((key) => {
|