Skip to content

Commit

Permalink
PLAN-324 still allow editing your own data
Browse files Browse the repository at this point in the history
- you can see and edit your own restricted data
- you cannot see and edit the restricted data of others unless you are an admin
  • Loading branch information
Gailbear committed Jun 4, 2022
1 parent 4452c7b commit 95cd4f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions app/javascript/profile/person_demographics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
<section>
<div class="d-flex flex-row mt-3">
<div class="w-50 mr-2">
<!-- TODO change edit permissions to sensitive data tickybox -->
<h5>Demographics <edit-button v-b-modal.person-demo-modal v-if="currentUserIsAdmin"></edit-button></h5>
<h5>Demographics <edit-button v-b-modal.person-demo-modal v-if="canEditInfo"></edit-button></h5>
<dl-person :fields="demoFields"></dl-person>
</div>
<div class="w-50">
<!-- TODO change edit permissions to sensitive data tickybox -->
<h5>Community memberships <edit-button v-b-modal.person-community-modal v-if="currentUserIsAdmin"></edit-button></h5>
<h5>Community memberships <edit-button v-b-modal.person-community-modal v-if="canEditInfo"></edit-button></h5>
<dl-person :fields="communityFields"></dl-person>
</div>
</div>
Expand Down Expand Up @@ -94,6 +92,10 @@ export default {
},
communityFields() {
return Object.keys(this.communityData);
},
canEditInfo() {
// TODO use sensitive data permission in the future
return this.currentUserIsAdmin || this.currentUser.id === this.selected.id;
}
}
};
Expand Down
8 changes: 6 additions & 2 deletions app/javascript/profile/person_details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<template #default="{fields}">
<b-form-group label="Anyone that should not be assigned to be on a panel with participant">
<!-- TODO change edit permissions to sensitive data tickybox -->
<b-form-textarea v-if="currentUserIsAdmin" v-model="fields.do_not_assign_with"></b-form-textarea>
<b-form-textarea v-if="!currentUserIsAdmin" disabled value="Restricted"></b-form-textarea>
<b-form-textarea v-if="canEditSensitiveInfo" v-model="fields.do_not_assign_with"></b-form-textarea>
<b-form-textarea v-if="!canEditSensitiveInfo" disabled value="Restricted"></b-form-textarea>
</b-form-group>

<b-form-group label="Permission to be included in a livestreamed program">
Expand Down Expand Up @@ -313,6 +313,10 @@ export default {
label: "Yes, except for items focused on the topics listed below.",
value: "maybe"};
},
canEditSensitiveInfo() {
// TODO in the future use the sensitive data permission instead of the admin setting
return this.currentUserIsAdmin || this.currentUser.id === this.selected.id;
}
},
}
</script>
Expand Down

0 comments on commit 95cd4f1

Please sign in to comment.