Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/EDX-1859' into fix/EDX-1859
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/package-lock.json
  • Loading branch information
mightycox committed Oct 11, 2023
2 parents 83626b2 + 6362e18 commit 2ae7114
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 12 deletions.
8 changes: 6 additions & 2 deletions backend/src/components/edx/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ async function districtUserActivationInvite(req, res) {
}

const payload = {
...req.body
...req.body,
edxUserExpiryDate: req.body.edxUserExpiryDate
};
try {
const response = await utils.postData(token, config.get('server:edx:districtUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username);
Expand All @@ -536,7 +537,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);
Expand Down Expand Up @@ -580,6 +582,7 @@ async function updateEdxUserSchoolRoles(req, res) {

selectedUserSchool.updateDate = null;
selectedUserSchool.createDate = 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);
Expand Down Expand Up @@ -621,6 +624,7 @@ async function updateEdxUserDistrictRoles(req, res) {

selectedUserDistrict.updateDate = null;
selectedUserDistrict.createDate = 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);
Expand Down
63 changes: 56 additions & 7 deletions frontend/src/components/secure-message/AccessUserCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
class="pt-2"
:style="[editState ? {'background-color': '#e7ebf0'} : {'background-color': 'white'}]"
>
<v-chip-group v-if="!editState">
<div v-if="!editState">
<v-chip-group >
<v-chip
v-for="role in userRoles"
:key="role.edxRoleCode"
Expand All @@ -101,8 +102,19 @@
{{ getRoleLabel(role) }}
</v-chip>
</v-chip-group>
<v-list
v-else
<p
v-if="getExpiryDate(user)"
class="expiry-date"
>
<v-icon size="large">
mdi-delete-clock-outline
</v-icon>
{{ formatExpiryDate(getExpiryDate(user)) }}
</p>
</div>

<div v-else>
<v-list
v-model:selected="selectedRoles"
lines="two"
return-object
Expand Down Expand Up @@ -137,6 +149,16 @@
</v-list-item>
</div>
</v-list>

<DatePicker
id="accessExpiryDate"
v-model="accessExpiryDate"
label="Access Expiry Date"
model-type="yyyy-MM-dd'T'00:00:00"
@clear-date="clearExpiryDate"
/>
</div>

</v-card-text>
<Transition name="bounce">
<v-card-text
Expand Down Expand Up @@ -252,10 +274,12 @@ import PrimaryButton from '@/components/util/PrimaryButton.vue';
import ApiService from '../../common/apiService';
import {EDX_SAGA_REQUEST_DELAY_MILLISECONDS, Routes} from '@/utils/constants';
import alertMixin from '@/mixins/alertMixin';
import {formatDate} from '../../utils/format';
import DatePicker from '../util/DatePicker.vue';
export default {
name: 'AccessUserCard',
components: {PrimaryButton},
components: {PrimaryButton, DatePicker},
mixins: [alertMixin],
props: {
user: {
Expand Down Expand Up @@ -289,7 +313,10 @@ export default {
deleteState: false,
relinkState: false,
isRelinking: false,
selectedRoles: []
selectedRoles: [],
accessExpiryDate: null,
from: 'uuuu-MM-dd\'T\'HH:mm:ss',
pickerFormat: 'uuuu-MM-dd'
};
},
computed: {
Expand Down Expand Up @@ -322,6 +349,15 @@ export default {
getButtonWidth() {
return '7em';
},
isDistrictUser(){
return this.instituteTypeCode === 'DISTRICT';
},
getExpiryDate(user){
if(!this.isDistrictUser()){
return user.edxUserSchools[0].expiryDate;
}
return user.edxUserDistricts[0].expiryDate;
},
getRoleLabel(curRole) {
if (this.instituteRoles.length > 0) {
return this.instituteRoles.find((role) => role.edxRoleCode === curRole.edxRoleCode).label;
Expand All @@ -344,6 +380,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 = {
Expand Down Expand Up @@ -405,7 +444,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;
Expand Down Expand Up @@ -440,7 +480,11 @@ export default {
});
this.selectedRoles = [...mySelection];
}
this.accessExpiryDate = this.user.edxUserSchools[0].expiryDate;
},
clearExpiryDate(){
this.accessExpiryDate = null;
},
}
};
</script>
Expand Down Expand Up @@ -470,5 +514,10 @@ export default {
transform: scale(1);
}
}
.expiry-date {
color: grey;
text-align: right;
}
</style>

20 changes: 18 additions & 2 deletions frontend/src/components/secure-message/InviteUserPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@
</v-list>
</template>
</v-select>

<DatePicker
id="accessExpiryDate"
v-model="accessExpiryDate"
class="pb-3 mt-0 pt-0"
label="Access Expiry Date"
model-type="yyyy-MM-dd'T'00:00:00"
@clear-date="clearExpiryDate"
/>
</v-card-text>
</v-col>
</v-row>
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -316,6 +329,9 @@ export default {
const isValid = this.$refs.newUserForm.validate();
this.isValidForm = isValid.valid;
},
clearExpiryDate(){
this.accessExpiryDate = null;
},
}
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion tools/config/update-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ae7114

Please sign in to comment.