@truedat/auth 4.45.1 → 4.45.6

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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.45.4] 2022-06-03
4
+
5
+ ### Fixed
6
+
7
+ - [TD-4873] Removed password and rep_password field from UserForm user update to avoid 403 error
8
+
3
9
  ## [4.44.4] 2022-05-19
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/auth",
3
- "version": "4.45.1",
3
+ "version": "4.45.6",
4
4
  "description": "Truedat Web Auth",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.45.1",
37
+ "@truedat/test": "4.45.6",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -87,7 +87,7 @@
87
87
  ]
88
88
  },
89
89
  "dependencies": {
90
- "@truedat/core": "4.45.1",
90
+ "@truedat/core": "4.45.6",
91
91
  "auth0-js": "^9.12.2",
92
92
  "immutable": "^4.0.0-rc.12",
93
93
  "jwt-decode": "^2.2.0",
@@ -109,5 +109,5 @@
109
109
  "react-dom": ">= 16.8.6 < 17",
110
110
  "semantic-ui-react": ">= 0.88.2 < 2.1"
111
111
  },
112
- "gitHead": "c13f37ee357bf4a5e8c8c99eb6bd0c798f468c49"
112
+ "gitHead": "6624767ce3b6893d538087057b662d11f90eb72d"
113
113
  }
@@ -67,6 +67,7 @@ export default {
67
67
  "permission.deprecate_business_concept": "Deprecate Business Concepts",
68
68
  "permission.deprecate_ingest": "Deprecate Ingests",
69
69
  "permission.deprecate_structure_note": "Deprecate note",
70
+ "permission.deprecate_implementation": "Delete Implementation",
70
71
  "permission.edit_structure_note": "Edit note",
71
72
  "permission.execute_quality_rule_implementations": "Execute Rules",
72
73
  "permission.group.business_glossary_management": "Business Glossary Management",
@@ -93,6 +94,7 @@ export default {
93
94
  "permission.manage_confidential_structures": "Manage Confidential Structures",
94
95
  "permission.manage_configurations": "Manage Configurations",
95
96
  "permission.manage_data_sources": "Manage Sources",
97
+ "permission.manage_draft_implementation": "Manage Draft Implementation",
96
98
  "permission.manage_ingest_relations": "Link Ingests",
97
99
  "permission.manage_quality_rule": "Manage Rules",
98
100
  "permission.manage_quality_rule_implementations": "Manage Implementations",
@@ -106,6 +108,7 @@ export default {
106
108
  "permission.profile_structures": "Execute Structure Profiling",
107
109
  "permission.publish_business_concept": "Publish Business Concepts",
108
110
  "permission.publish_ingest": "Publish Ingests",
111
+ "permission.publish_implementation": "Publish Implementation",
109
112
  "permission.publish_structure_note": "Publish note",
110
113
  "permission.publish_structure_note_from_draft": "Publish note from draft",
111
114
  "permission.reject_business_concept": "Reject Business Concepts",
@@ -66,6 +66,7 @@ export default {
66
66
  "permission.delete_structure_note": "Borrar nota",
67
67
  "permission.deprecate_business_concept": "Archivar conceptos",
68
68
  "permission.deprecate_ingest": "Archivar Ingesta",
69
+ "permission.deprecate_implementation": "Borrar Implementaciones",
69
70
  "permission.deprecate_structure_note": "Archivar nota",
70
71
  "permission.edit_structure_note": "Editar nota",
71
72
  "permission.execute_quality_rule_implementations": "Ejecutar Implementaciones",
@@ -94,6 +95,7 @@ export default {
94
95
  "permission.manage_confidential_structures": "Gestionar estructuras confidenciales",
95
96
  "permission.manage_configurations": "Gestionar Configuraciones",
96
97
  "permission.manage_data_sources": "Gestionar Orígenes",
98
+ "permission.manage_draft_implementation": "Gestionar borradores de Implementaciones",
97
99
  "permission.manage_ingest_relations": "Vincular datos a ingestas",
98
100
  "permission.manage_quality_rule": "Gestionar Reglas de Calidad",
99
101
  "permission.manage_quality_rule_implementations": "Gestionar implementaciones de reglas",
@@ -107,6 +109,7 @@ export default {
107
109
  "permission.profile_structures": "Ejecutar perfilado de estructuras",
108
110
  "permission.publish_business_concept": "Aprobar conceptos",
109
111
  "permission.publish_ingest": "Publicar Ingesta",
112
+ "permission.publish_implementation": "Publicar Implementacion",
110
113
  "permission.publish_structure_note": "Publicar nota",
111
114
  "permission.publish_structure_note_from_draft": "Publicar nota desde borrador",
112
115
  "permission.reject_business_concept": "Rechazar conceptos",
@@ -126,7 +126,21 @@ export const UserForm = ({ isSubmitting, onSubmit, user, groups }) => {
126
126
  rep_password: "",
127
127
  ...user,
128
128
  },
129
+ /*
130
+ * Remove PasswordFormFields' inputs (password, rep_password) if it is not
131
+ * mounted (user update). Keep them if it is mounted (user creation).
132
+ * Otherwise, td-auth returns forbidden because password updates are handled
133
+ * in the Password form, using /api/password, not in this UserForm that
134
+ * PUTs to /api/users/<user_id>
135
+ * https://stackoverflow.com/q/70105636
136
+ * This was not needed in v6, but it is in v7:
137
+ * https://react-hook-form.com/migrate-v6-to-v7/
138
+ * Important: input value and reference will no longer get removed after
139
+ * unmount unless shouldUnregister is true.
140
+ */
141
+ shouldUnregister: true,
129
142
  });
143
+
130
144
  const { errors, isDirty, isValid } = formState;
131
145
  return (
132
146
  <Form onSubmit={handleSubmit(onSubmit)}>
@@ -0,0 +1,96 @@
1
+ import { testSaga } from "redux-saga-test-plan";
2
+ import { apiJsonPut, JSON_OPTS } from "@truedat/core/services/api";
3
+ import { takeLatest } from "redux-saga/effects";
4
+ import {
5
+ updateUserRequestSaga,
6
+ updateUserSaga,
7
+ updatePasswordSaga,
8
+ } from "../updateUser";
9
+ import { updateUser, updatePassword } from "../../routines";
10
+ import { API_USER } from "../../api";
11
+
12
+ describe("sagas: updateUserRequestSaga", () => {
13
+ it("should invoke updateUserSaga on updateUser.TRIGGER", () => {
14
+ expect(() => {
15
+ testSaga(updateUserRequestSaga)
16
+ .next()
17
+ .all([
18
+ takeLatest(updateUser.TRIGGER, updateUserSaga),
19
+ takeLatest(updatePassword.TRIGGER, updatePasswordSaga),
20
+ ])
21
+ .finish()
22
+ .isDone();
23
+ }).not.toThrow();
24
+ });
25
+
26
+ it("should throw exception if an unhandled action is received", () => {
27
+ expect(() => {
28
+ testSaga(updateUserRequestSaga)
29
+ .next()
30
+ .takeLatest("FOO", updateUserRequestSaga);
31
+ }).toThrow();
32
+ });
33
+ });
34
+
35
+ describe("sagas: updateUserSaga", () => {
36
+ const userId = 1;
37
+ const user = {
38
+ id: userId,
39
+ user_name: "uname",
40
+ email: "email@email.com",
41
+ full_name: "User Full Name",
42
+ groups: "[]",
43
+ role: "admin",
44
+ };
45
+ const payload = {
46
+ user,
47
+ };
48
+ const request_data = {
49
+ user,
50
+ };
51
+
52
+ it("should put a success action when a response is returned", () => {
53
+ expect(() => {
54
+ testSaga(updateUserSaga, { payload: user })
55
+ .next()
56
+ .put({ ...updateUser.request() })
57
+ .next()
58
+ .call(
59
+ apiJsonPut,
60
+ API_USER.replace(":id", userId),
61
+ request_data,
62
+ JSON_OPTS
63
+ )
64
+ .next({ data: payload })
65
+ .put({ ...updateUser.success(payload) })
66
+ .next()
67
+ .put(updateUser.fulfill())
68
+ .next()
69
+ .isDone();
70
+ }).not.toThrow();
71
+ });
72
+
73
+ it("should put a failure action when the call returns an error", () => {
74
+ const message = "Request failed";
75
+ const error = { message };
76
+
77
+ expect(() => {
78
+ testSaga(updateUserSaga, { payload: user })
79
+ .next()
80
+ .put({ ...updateUser.request() })
81
+ .next()
82
+ .call(
83
+ apiJsonPut,
84
+ API_USER.replace(":id", userId),
85
+ request_data,
86
+ JSON_OPTS
87
+ )
88
+ .throw(error)
89
+ .put(updateUser.failure(message))
90
+ .next()
91
+ .put(updateUser.fulfill())
92
+ .next()
93
+ .isDone();
94
+ }).not.toThrow();
95
+ });
96
+ });
@@ -39,6 +39,6 @@ export function* updatePasswordSaga({ payload }) {
39
39
  export function* updateUserRequestSaga() {
40
40
  yield all([
41
41
  takeLatest(updateUser.TRIGGER, updateUserSaga),
42
- takeLatest(updatePassword.TRIGGER, updatePasswordSaga)
42
+ takeLatest(updatePassword.TRIGGER, updatePasswordSaga),
43
43
  ]);
44
44
  }