From 18dce40475e4dc8542424ce2dab70278f7a45c6a Mon Sep 17 00:00:00 2001 From: Marco Villeneuve Date: Tue, 10 Oct 2023 11:55:12 -0700 Subject: [PATCH 1/6] Small update for not using SDC --- tools/config/update-configmap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config/update-configmap.sh b/tools/config/update-configmap.sh index fa43033d8..db285337f 100644 --- a/tools/config/update-configmap.sh +++ b/tools/config/update-configmap.sh @@ -278,7 +278,7 @@ elif [ "$envValue" = "test" ]; then bannerEnvironment="TEST" bannerColor="#58fe01" SCHEDULER_CRON_DOC_TYPE_MIGRATION="0 0 0 * * *" - disableSdcFunctionality=false + disableSdcFunctionality=true else SCHEDULER_CRON_DOC_TYPE_MIGRATION="0 0 0 17 9 *" disableSdcFunctionality=true From cbc1c56f7394eb30f7865d13e5cadef860866fc0 Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:35:56 -0700 Subject: [PATCH 2/6] MIN: Set Expiry Date for EDX User --- backend/src/components/edx/exchange.js | 13 +- frontend/package-lock.json | 158 +++++++++++------- frontend/package.json | 1 + .../secure-message/AccessUserCard.vue | 65 ++++++- .../secure-message/InviteUserPage.vue | 20 ++- 5 files changed, 180 insertions(+), 77 deletions(-) diff --git a/backend/src/components/edx/exchange.js b/backend/src/components/edx/exchange.js index 96578dcd2..f8f0dc889 100644 --- a/backend/src/components/edx/exchange.js +++ b/backend/src/components/edx/exchange.js @@ -6,7 +6,7 @@ const config = require('../../config'); const {getData, getCodeTable, putData} = require('../utils'); const utils = require('../utils'); const {FILTER_OPERATION, VALUE_TYPE, CACHE_KEYS} = require('../../util/constants'); -const {LocalDateTime, DateTimeFormatter} = require('@js-joda/core'); +const {LocalDateTime, LocalDate, DateTimeFormatter} = require('@js-joda/core'); const cacheService = require('../cache-service'); const log = require('../logger'); @@ -497,6 +497,7 @@ async function checkIfPrimaryCodeExists(req,res, token, instituteType, institute async function districtUserActivationInvite(req, res) { const token = utils.getBackendToken(req); + const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); if (!token) { return res.status(HttpStatus.UNAUTHORIZED).json({ message: 'No access token' @@ -510,7 +511,8 @@ async function districtUserActivationInvite(req, res) { } const payload = { - ...req.body + ...req.body, + edxUserExpiryDate: req.body.edxUserExpiryDate ? LocalDate.parse(req.body.edxUserExpiryDate).atStartOfDay().format(formatter) : null }; try { const response = await utils.postData(token, config.get('server:edx:districtUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username); @@ -536,7 +538,8 @@ async function schoolUserActivationInvite(req, res) { } const payload = { - ...req.body + ...req.body, + edxUserExpiryDate: req.body.edxUserExpiryDate }; try { const response = await utils.postData(token, config.get('server:edx:schoolUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username); @@ -552,6 +555,7 @@ async function updateEdxUserSchoolRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); + const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserSchools = edxUser.edxUserSchools.filter(school => school.schoolID === req.body.params.schoolID); @@ -580,6 +584,7 @@ async function updateEdxUserSchoolRoles(req, res) { selectedUserSchool.updateDate = null; selectedUserSchool.createDate = null; + selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserSchool.edxUserID}/school`, selectedUserSchool, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); @@ -593,6 +598,7 @@ async function updateEdxUserDistrictRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); + const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserDistricts = edxUser.edxUserDistricts.filter(district => district.districtID === req.body.params.districtId); @@ -621,6 +627,7 @@ async function updateEdxUserDistrictRoles(req, res) { selectedUserDistrict.updateDate = null; selectedUserDistrict.createDate = null; + selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserDistrict.edxUserID}/district`, selectedUserDistrict, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7d92530ac..8e61fe281 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,6 +12,7 @@ "@fortawesome/fontawesome-free": "6.4.0", "@js-joda/core": "^5.5.3", "@mdi/font": "^7.2.96", + "@vuepic/vue-datepicker": "^4.2.0", "axios": "^1.4.0", "chart.js": "^4.3.0", "chartjs-plugin-datalabels": "^2.2.0", @@ -43,7 +44,6 @@ "vue-meta": "^3.0.0-alpha.10", "vue-quick-chat": "^1.2.8", "vue-router": "^4.2.2", - "vue3-treeview": "^0.4.1", "vuetify": "npm:@vuetify/nightly@3.3.5-pr-17265.042d482" }, "devDependencies": { @@ -569,6 +569,22 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/runtime": { + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.1.tgz", + "integrity": "sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + }, "node_modules/@babel/template": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", @@ -2239,6 +2255,21 @@ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz", "integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==" }, + "node_modules/@vuepic/vue-datepicker": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-4.5.1.tgz", + "integrity": "sha512-zdG37Q8iuwTPWnQEI9/WvabqmrDDfDLgdXUTW08FXHSbiHuNN2S+bVeN1Wm9yeD+onHgzEn6DiW6J3fYXEfa0Q==", + "dependencies": { + "date-fns": "^2.29.3", + "date-fns-tz": "^1.3.7" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "vue": ">=3.2.0" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -3097,6 +3128,29 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/date-fns-tz": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.8.tgz", + "integrity": "sha512-qwNXUFtMHTTU6CFSFjoJ80W8Fzzp24LntbjFFBgL/faqds4e5mo9mftoRLgr3Vi1trISsg4awSpYVsOQCRnapQ==", + "peerDependencies": { + "date-fns": ">=2.0.0" + } + }, "node_modules/de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -6652,32 +6706,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash.eq": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lodash.eq/-/lodash.eq-4.0.0.tgz", - "integrity": "sha512-vbrJpXL6kQNG6TkInxX12DZRfuYVllSxhwYqjYB78g2zF3UI15nFO/0AgmZnZRnaQ38sZtjCiVjGr2rnKt4v0g==" - }, - "node_modules/lodash.isnil": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lodash.isnil/-/lodash.isnil-4.0.0.tgz", - "integrity": "sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng==" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "node_modules/lodash.tointeger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.tointeger/-/lodash.tointeger-4.0.4.tgz", - "integrity": "sha512-UQbTdxNHMm4jGlf+LtxB5ZPJFufuND2gZCYjMxSOUmcxfq350x9KnwL3EzxDDNth8fOZ9wpwDTGWZQnFgdV3gg==" - }, - "node_modules/lodash.uniqueid": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz", - "integrity": "sha512-GQQWaIeGlL6DIIr06kj1j6sSmBxyNMwI8kaX9aKpHR/XsMTiaXDVPNPAkiboOTK9OJpTJF/dXT3xYoFQnj386Q==" - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -8420,18 +8454,6 @@ "he": "^1.2.0" } }, - "node_modules/vue3-treeview": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/vue3-treeview/-/vue3-treeview-0.4.1.tgz", - "integrity": "sha512-IUQN9Gzqxr66Qc6l+Js+ZBo57q5dHmiyD6FBRdt2WRnmMZ+wRtZ2UuwdLMiuGBT6gOVEzL7ucLIZGPZyKyyI4g==", - "dependencies": { - "lodash.eq": "^4.0.0", - "lodash.isnil": "^4.0.0", - "lodash.tointeger": "^4.0.4", - "lodash.uniqueid": "^4.0.1", - "vue": "^3.1.2" - } - }, "node_modules/vuetify": { "name": "@vuetify/nightly", "version": "3.3.5-pr-17265.042d482", @@ -9056,6 +9078,21 @@ "@babel/helper-plugin-utils": "^7.19.0" } }, + "@babel/runtime": { + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.1.tgz", + "integrity": "sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g==", + "requires": { + "regenerator-runtime": "^0.14.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + } + } + }, "@babel/template": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", @@ -10270,6 +10307,15 @@ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz", "integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==" }, + "@vuepic/vue-datepicker": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-4.5.1.tgz", + "integrity": "sha512-zdG37Q8iuwTPWnQEI9/WvabqmrDDfDLgdXUTW08FXHSbiHuNN2S+bVeN1Wm9yeD+onHgzEn6DiW6J3fYXEfa0Q==", + "requires": { + "date-fns": "^2.29.3", + "date-fns-tz": "^1.3.7" + } + }, "@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -10929,6 +10975,20 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, + "date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "requires": { + "@babel/runtime": "^7.21.0" + } + }, + "date-fns-tz": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.8.tgz", + "integrity": "sha512-qwNXUFtMHTTU6CFSFjoJ80W8Fzzp24LntbjFFBgL/faqds4e5mo9mftoRLgr3Vi1trISsg4awSpYVsOQCRnapQ==", + "requires": {} + }, "de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -13557,32 +13617,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lodash.eq": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lodash.eq/-/lodash.eq-4.0.0.tgz", - "integrity": "sha512-vbrJpXL6kQNG6TkInxX12DZRfuYVllSxhwYqjYB78g2zF3UI15nFO/0AgmZnZRnaQ38sZtjCiVjGr2rnKt4v0g==" - }, - "lodash.isnil": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lodash.isnil/-/lodash.isnil-4.0.0.tgz", - "integrity": "sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng==" - }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "lodash.tointeger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.tointeger/-/lodash.tointeger-4.0.4.tgz", - "integrity": "sha512-UQbTdxNHMm4jGlf+LtxB5ZPJFufuND2gZCYjMxSOUmcxfq350x9KnwL3EzxDDNth8fOZ9wpwDTGWZQnFgdV3gg==" - }, - "lodash.uniqueid": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz", - "integrity": "sha512-GQQWaIeGlL6DIIr06kj1j6sSmBxyNMwI8kaX9aKpHR/XsMTiaXDVPNPAkiboOTK9OJpTJF/dXT3xYoFQnj386Q==" - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -14756,18 +14796,6 @@ "he": "^1.2.0" } }, - "vue3-treeview": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/vue3-treeview/-/vue3-treeview-0.4.1.tgz", - "integrity": "sha512-IUQN9Gzqxr66Qc6l+Js+ZBo57q5dHmiyD6FBRdt2WRnmMZ+wRtZ2UuwdLMiuGBT6gOVEzL7ucLIZGPZyKyyI4g==", - "requires": { - "lodash.eq": "^4.0.0", - "lodash.isnil": "^4.0.0", - "lodash.tointeger": "^4.0.4", - "lodash.uniqueid": "^4.0.1", - "vue": "^3.1.2" - } - }, "vuetify": { "version": "npm:@vuetify/nightly@3.3.5-pr-17265.042d482", "resolved": "https://registry.npmjs.org/@vuetify/nightly/-/nightly-3.3.5-pr-17265.042d482.tgz", diff --git a/frontend/package.json b/frontend/package.json index 73ee26b31..a01b72896 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "@fortawesome/fontawesome-free": "6.4.0", "@js-joda/core": "^5.5.3", "@mdi/font": "^7.2.96", + "@vuepic/vue-datepicker": "^4.2.0", "axios": "^1.4.0", "chart.js": "^4.3.0", "chartjs-plugin-datalabels": "^2.2.0", diff --git a/frontend/src/components/secure-message/AccessUserCard.vue b/frontend/src/components/secure-message/AccessUserCard.vue index 5e06938cf..a39a25173 100644 --- a/frontend/src/components/secure-message/AccessUserCard.vue +++ b/frontend/src/components/secure-message/AccessUserCard.vue @@ -92,7 +92,8 @@ class="pt-2" :style="[editState ? {'background-color': '#e7ebf0'} : {'background-color': 'white'}]" > - +
+ - + + mdi-delete-clock-outline + + {{ formatExpiryDate(getExpiryDate(user)) }} +

+
+ +
+
+ + + + 0) { return this.instituteRoles.find((role) => role.edxRoleCode === curRole.edxRoleCode).label; } return ''; }, + formatExpiryDate(date) { + return formatDate(date, this.from, this.pickerFormat); + }, clickEditButton() { this.relinkState = false; this.deleteState = false; @@ -344,6 +382,9 @@ export default { this.deleteState = false; this.relinkState = !this.relinkState; }, + formatExpiryDate(date) { + return formatDate(date, this.from, this.pickerFormat); + }, clickActionRelinkButton() { this.isRelinking = true; const payload = { @@ -405,7 +446,8 @@ export default { const payload = { params: { edxUserID: this.user.edxUserID, - selectedRoles: this.selectedRoles + selectedRoles: this.selectedRoles, + expiryDate: this.accessExpiryDate } }; let url = Routes.edx.EXCHANGE_ACCESS_ROLES_URL; @@ -440,7 +482,11 @@ export default { }); this.selectedRoles = [...mySelection]; - } + this.accessExpiryDate = this.formatExpiryDate(this.user.edxUserSchools[0].expiryDate); + }, + clearExpiryDate(){ + this.accessExpiryDate = null; + }, } }; @@ -470,5 +516,10 @@ export default { transform: scale(1); } } + +.expiry-date { + color: grey; + text-align: right; +} diff --git a/frontend/src/components/secure-message/InviteUserPage.vue b/frontend/src/components/secure-message/InviteUserPage.vue index d2397e9fc..34d48bba9 100644 --- a/frontend/src/components/secure-message/InviteUserPage.vue +++ b/frontend/src/components/secure-message/InviteUserPage.vue @@ -114,6 +114,15 @@ + + @@ -155,12 +164,14 @@ import {Routes} from '@/utils/constants'; import {mapState} from 'pinia'; import {authStore} from '@/store/modules/auth'; import {appStore} from '@/store/modules/app'; +import DatePicker from '../util/DatePicker.vue'; export default { name: 'InviteUserPage', components: { PrimaryButton, ConfirmationDialog, + DatePicker }, mixins: [alertMixin], props: { @@ -207,7 +218,8 @@ export default { processing: false, edxAdminUserCode: '', rolesHint: 'Pick the roles to be assigned to the new user', - emailHint: 'Valid Email Required' + emailHint: 'Valid Email Required', + accessExpiryDate: null }; }, mounted() { @@ -286,7 +298,8 @@ export default { firstName: this.firstName, lastName: this.lastName, email: this.email, - edxActivationRoleCodes: this.edxActivationRoleCodes + edxActivationRoleCodes: this.edxActivationRoleCodes, + edxUserExpiryDate: this.accessExpiryDate }; let url = null; if (this.instituteTypeCode === 'SCHOOL') { @@ -316,6 +329,9 @@ export default { const isValid = this.$refs.newUserForm.validate(); this.isValidForm = isValid.valid; }, + clearExpiryDate(){ + this.accessExpiryDate = null; + }, } }; From 0851dcae8f1431f18e36276314b821bd65a93ed7 Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:38:10 -0700 Subject: [PATCH 3/6] Update exchange.js --- backend/src/components/edx/exchange.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/components/edx/exchange.js b/backend/src/components/edx/exchange.js index f8f0dc889..8e5372148 100644 --- a/backend/src/components/edx/exchange.js +++ b/backend/src/components/edx/exchange.js @@ -627,7 +627,7 @@ async function updateEdxUserDistrictRoles(req, res) { selectedUserDistrict.updateDate = null; selectedUserDistrict.createDate = null; - selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; + selectedUserDistrict.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserDistrict.edxUserID}/district`, selectedUserDistrict, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); From 54af28298a87a1142715f5112ecb819ab29e524d Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:39:58 -0700 Subject: [PATCH 4/6] Update AccessUserCard.vue --- frontend/src/components/secure-message/AccessUserCard.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/src/components/secure-message/AccessUserCard.vue b/frontend/src/components/secure-message/AccessUserCard.vue index a39a25173..e3c5f4dee 100644 --- a/frontend/src/components/secure-message/AccessUserCard.vue +++ b/frontend/src/components/secure-message/AccessUserCard.vue @@ -363,9 +363,6 @@ export default { } return ''; }, - formatExpiryDate(date) { - return formatDate(date, this.from, this.pickerFormat); - }, clickEditButton() { this.relinkState = false; this.deleteState = false; From c452ca2fd078650131fc08eb0b9096abd50fee4a Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:46:54 -0700 Subject: [PATCH 5/6] removed date formatter --- backend/src/components/edx/exchange.js | 9 +++------ .../src/components/secure-message/AccessUserCard.vue | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/components/edx/exchange.js b/backend/src/components/edx/exchange.js index 8e5372148..36b81103a 100644 --- a/backend/src/components/edx/exchange.js +++ b/backend/src/components/edx/exchange.js @@ -497,7 +497,6 @@ async function checkIfPrimaryCodeExists(req,res, token, instituteType, institute async function districtUserActivationInvite(req, res) { const token = utils.getBackendToken(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); if (!token) { return res.status(HttpStatus.UNAUTHORIZED).json({ message: 'No access token' @@ -512,7 +511,7 @@ async function districtUserActivationInvite(req, res) { const payload = { ...req.body, - edxUserExpiryDate: req.body.edxUserExpiryDate ? LocalDate.parse(req.body.edxUserExpiryDate).atStartOfDay().format(formatter) : null + edxUserExpiryDate: req.body.edxUserExpiryDate }; try { const response = await utils.postData(token, config.get('server:edx:districtUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username); @@ -555,7 +554,6 @@ async function updateEdxUserSchoolRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserSchools = edxUser.edxUserSchools.filter(school => school.schoolID === req.body.params.schoolID); @@ -584,7 +582,7 @@ async function updateEdxUserSchoolRoles(req, res) { selectedUserSchool.updateDate = null; selectedUserSchool.createDate = null; - selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; + selectedUserSchool.expiryDate = req.body.params.expiryDate; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserSchool.edxUserID}/school`, selectedUserSchool, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); @@ -598,7 +596,6 @@ async function updateEdxUserDistrictRoles(req, res) { try { const token = utils.getBackendToken(req); const userInfo = utils.getUser(req); - const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss'); let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`); let selectedUserDistricts = edxUser.edxUserDistricts.filter(district => district.districtID === req.body.params.districtId); @@ -627,7 +624,7 @@ async function updateEdxUserDistrictRoles(req, res) { selectedUserDistrict.updateDate = null; selectedUserDistrict.createDate = null; - selectedUserDistrict.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null; + selectedUserDistrict.expiryDate = req.body.params.expiryDate; const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserDistrict.edxUserID}/district`, selectedUserDistrict, userInfo.idir_username); return res.status(HttpStatus.OK).json(result); diff --git a/frontend/src/components/secure-message/AccessUserCard.vue b/frontend/src/components/secure-message/AccessUserCard.vue index e3c5f4dee..ef0516c5a 100644 --- a/frontend/src/components/secure-message/AccessUserCard.vue +++ b/frontend/src/components/secure-message/AccessUserCard.vue @@ -154,6 +154,7 @@ id="accessExpiryDate" v-model="accessExpiryDate" label="Access Expiry Date" + model-type="yyyy-MM-dd'T'00:00:00" @clear-date="clearExpiryDate" /> @@ -479,7 +480,7 @@ export default { }); this.selectedRoles = [...mySelection]; - this.accessExpiryDate = this.formatExpiryDate(this.user.edxUserSchools[0].expiryDate); + this.accessExpiryDate = this.user.edxUserSchools[0].expiryDate; }, clearExpiryDate(){ this.accessExpiryDate = null; From eed22aa9d0106f463ccfac189bb047fd342f6d2c Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:49:38 -0700 Subject: [PATCH 6/6] Update exchange.js --- backend/src/components/edx/exchange.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/components/edx/exchange.js b/backend/src/components/edx/exchange.js index 36b81103a..f7515c89a 100644 --- a/backend/src/components/edx/exchange.js +++ b/backend/src/components/edx/exchange.js @@ -6,7 +6,7 @@ const config = require('../../config'); const {getData, getCodeTable, putData} = require('../utils'); const utils = require('../utils'); const {FILTER_OPERATION, VALUE_TYPE, CACHE_KEYS} = require('../../util/constants'); -const {LocalDateTime, LocalDate, DateTimeFormatter} = require('@js-joda/core'); +const {LocalDateTime, DateTimeFormatter} = require('@js-joda/core'); const cacheService = require('../cache-service'); const log = require('../logger');