Skip to content

Commit 4220ff4

Browse files
- ADD: Added primary contact flag to user permissions UI.
- CHG: Version bump.
1 parent 4d998a2 commit 4220ff4

File tree

8 files changed

+92
-22
lines changed

8 files changed

+92
-22
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gatekeeper",
3-
"version": "4.8.4",
3+
"version": "4.8.5",
44
"description": "",
55
"author": "Sebastian Raubach",
66
"scripts": {
@@ -18,7 +18,7 @@
1818
"vue": "^2.6.14",
1919
"vue-flag-icon": "~1.0.6",
2020
"vue-i18n": "^8.27.1",
21-
"vue-material-design-icons": "~3.2.0",
21+
"vue-material-design-icons": "^5.3.1",
2222
"vue-router": "^3.5.1",
2323
"vuex": "^3.6.2",
2424
"vuex-persistedstate": "^4.1.0",

src/components/DatabasePermissionTable.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
:options="userTypeOptions"
1414
@change="setUserType(data.item, $event)" />
1515
</template>
16+
<template #cell(userIsPrimaryContact)="data">
17+
<b-form-checkbox
18+
value="1"
19+
unchecked-value="0"
20+
switch
21+
:checked="data.item.userIsPrimaryContact"
22+
@change="setUserPrimary(data.item, $event)" />
23+
</template>
1624
</BaseTable>
1725
</template>
1826

@@ -65,6 +73,10 @@ export default {
6573
key: 'userTypeId',
6674
label: this.$t('tableColumnUserType'),
6775
sortable: true
76+
}, {
77+
key: 'userIsPrimaryContact',
78+
label: this.$t('tableColumnUserIsPrimary'),
79+
sortable: true
6880
}, {
6981
key: 'delete',
7082
label: this.$t('actionDelete'),
@@ -83,6 +95,11 @@ export default {
8395
refresh: function () {
8496
this.$refs.table.refresh()
8597
},
98+
setUserPrimary: function (row, newValue) {
99+
const payload = JSON.parse(JSON.stringify(row))
100+
payload.userIsPrimaryContact = newValue
101+
this.apiPatchUserPermission(payload, () => this.refresh())
102+
},
86103
setUserType: function (row, newValue) {
87104
const payload = JSON.parse(JSON.stringify(row))
88105
payload.userTypeId = newValue

src/components/UserPermissionTable.vue

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
<template>
22
<BaseTable :columns="columns" :getData="getData" ref="table">
3-
<template v-slot:cell(delete)="data">
3+
<template #cell(delete)="data">
44
<b-button variant="danger"
55
size="sm"
66
@click="deleteUserPermission(data.item)">
77
<MdiIcon :path="mdiDelete" />
88
</b-button>
99
</template>
10-
<template v-slot:cell(userTypeId)="data">
10+
<template #cell(userTypeId)="data">
1111
<b-form-select
12-
:value="data.item.userTypeId"
13-
:options="userTypeOptions"
14-
@change="setUserType(data.item, $event)" />
12+
class="user-type-select"
13+
:value="data.item.userTypeId"
14+
:options="userTypeOptions"
15+
@change="setUserType(data.item, $event)" />
16+
</template>
17+
<template #cell(userIsPrimaryContact)="data">
18+
<b-form-checkbox
19+
value="1"
20+
unchecked-value="0"
21+
switch
22+
:checked="data.item.userIsPrimaryContact"
23+
@change="setUserPrimary(data.item, $event)" />
1524
</template>
1625
</BaseTable>
1726
</template>
@@ -59,6 +68,10 @@ export default {
5968
key: 'userTypeId',
6069
label: this.$t('tableColumnUserType'),
6170
sortable: true
71+
}, {
72+
key: 'userIsPrimaryContact',
73+
label: this.$t('tableColumnUserIsPrimary'),
74+
sortable: true
6275
}, {
6376
key: 'delete',
6477
label: this.$t('actionDelete'),
@@ -83,6 +96,11 @@ export default {
8396
refresh: function () {
8497
this.$refs.table.refresh()
8598
},
99+
setUserPrimary: function (row, newValue) {
100+
const payload = JSON.parse(JSON.stringify(row))
101+
payload.userIsPrimaryContact = newValue
102+
this.apiPatchUserPermission(payload, () => this.refresh())
103+
},
86104
setUserType: function (row, newValue) {
87105
const payload = JSON.parse(JSON.stringify(row))
88106
payload.userTypeId = newValue
@@ -105,6 +123,8 @@ export default {
105123
}
106124
</script>
107125

108-
<style>
109-
126+
<style scoped>
127+
.user-type-select {
128+
min-width: 100px;
129+
}
110130
</style>

src/lang/de_DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"tableColumnInstituteAddress": "Institutsadresse",
117117
"tableColumnLastLogin": "Letzte Anmeldung",
118118
"tableColumnUserType": "Benutzertyp",
119+
"tableColumnUserIsPrimary": "Ist primärer Kontakt",
119120
"tableColumnRequestsAccessTo": "Fragt nach Zugriff auf",
120121
"tableColumnRequestsActivationKey": "Email-Aktivierung",
121122
"tableColumnRequestsOnServer": "Auf Server",

src/lang/en_GB.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"errorMessageInvalidUsernamePassword": "Invalid username or password",
1616
"errorMessageActivationInvalidKey": "Invalid activation key. This can happen if the account has already been activated.",
1717
"errorMessageNoActivationKey": "No activation key provided.",
18-
"appVersion": "4.8.4",
18+
"appVersion": "4.8.5",
1919
"formLabelEmail": "Email address",
2020
"formLabelCurrentPassword": "Old password",
2121
"formLabelUsername": "Username",
@@ -118,6 +118,7 @@
118118
"tableColumnInstituteAddress": "Institute address",
119119
"tableColumnLastLogin": "Last login",
120120
"tableColumnUserType": "User type",
121+
"tableColumnUserIsPrimary": "Is primary contact",
121122
"tableColumnRequestsAccessTo": "Requests access to",
122123
"tableColumnRequestsActivationKey": "Email activation",
123124
"tableColumnRequestsOnServer": "On server",

src/views/Main.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<template v-if="token && token.fullName">
88
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">{{ token.fullName }}</h6>
99
<ul class="nav flex-column">
10-
<b-nav-item to="/"><SettingsIcon class="mr-2" /><span>{{ $t('menuUserSettings') }}</span></b-nav-item>
10+
<b-nav-item to="/"><CogIcon class="mr-2" /><span>{{ $t('menuUserSettings') }}</span></b-nav-item>
1111
</ul>
1212
</template>
1313
<template v-if="stats">
@@ -38,7 +38,7 @@
3838
import AccountGroupIcon from 'vue-material-design-icons/AccountGroup'
3939
import AccountQuestionIcon from 'vue-material-design-icons/AccountQuestion'
4040
import DatabaseIcon from 'vue-material-design-icons/Database'
41-
import SettingsIcon from 'vue-material-design-icons/Settings'
41+
import CogIcon from 'vue-material-design-icons/Cog'
4242
import { mapState } from 'vuex'
4343
import { EventBus } from '../event-bus.js'
4444
@@ -53,7 +53,7 @@ export default {
5353
AccountGroupIcon,
5454
AccountQuestionIcon,
5555
DatabaseIcon,
56-
SettingsIcon
56+
CogIcon
5757
},
5858
computed: {
5959
...mapState([

src/views/Users.vue

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@
7070
:options="userTypeOptions"
7171
required />
7272
</b-input-group>
73+
<b-input-group class="mt-3">
74+
<b-input-group-prepend is-text>
75+
<CardAccountMailIcon class="form-icon" />
76+
</b-input-group-prepend>
77+
<b-form-checkbox v-model="newPermission.userIsPrimaryContact"
78+
value="1"
79+
unchecked-value="0"
80+
class="form-control form-checkbox"
81+
switch
82+
required>{{ $t('tableColumnUserIsPrimary') }}</b-form-checkbox>
83+
</b-input-group>
7384
<b-button type="submit" variant="primary" class="mt-3">{{ $t('actionAdd') }}</b-button>
7485
</b-form>
7586
</b-tab>
@@ -106,6 +117,17 @@
106117
:options="userTypeOptions"
107118
required />
108119
</b-input-group>
120+
<b-input-group class="mt-3">
121+
<b-input-group-prepend is-text>
122+
<CardAccountMailIcon class="form-icon" />
123+
</b-input-group-prepend>
124+
<b-form-checkbox v-model="newPermission.userIsPrimaryContact"
125+
value="1"
126+
unchecked-value="0"
127+
class="form-control form-checkbox"
128+
switch
129+
required>{{ $t('tableColumnUserIsPrimary') }}</b-form-checkbox>
130+
</b-input-group>
109131
<b-button type="submit" variant="primary" class="mt-3">{{ $t('actionAdd') }}</b-button>
110132
</b-form>
111133
</b-tab>
@@ -119,6 +141,7 @@
119141

120142
<script>
121143
import AccountStarIcon from 'vue-material-design-icons/AccountStar.vue'
144+
import CardAccountMailIcon from 'vue-material-design-icons/CardAccountMail.vue'
122145
import DatabaseIcon from 'vue-material-design-icons/Database.vue'
123146
import PencilIcon from 'vue-material-design-icons/Pencil.vue'
124147
import ServerIcon from 'vue-material-design-icons/Server.vue'
@@ -137,7 +160,8 @@ export default {
137160
database: null,
138161
server: null,
139162
description: null,
140-
userType: 2
163+
userType: 2,
164+
userIsPrimaryContact: false
141165
},
142166
userTypeOptions: [{
143167
value: 1,
@@ -160,7 +184,8 @@ export default {
160184
PencilIcon,
161185
ServerIcon,
162186
UserTable,
163-
UserPermissionTable
187+
UserPermissionTable,
188+
CardAccountMailIcon
164189
},
165190
methods: {
166191
getInstitution: function () {
@@ -194,7 +219,8 @@ export default {
194219
database: null,
195220
server: null,
196221
description: null,
197-
userType: 2
222+
userType: 2,
223+
userIsPrimaryContact: false
198224
}
199225
},
200226
onDeleteUserClicked: function () {
@@ -230,7 +256,8 @@ export default {
230256
const toSend = {
231257
userId: this.user.id,
232258
databaseId: result,
233-
userTypeId: this.newPermission.userType
259+
userTypeId: this.newPermission.userType,
260+
userIsPrimaryContact: this.newPermission.userIsPrimaryContact
234261
}
235262
236263
EventBus.$emit('stats-count-changed')
@@ -248,7 +275,8 @@ export default {
248275
const toSend = {
249276
userId: this.user.id,
250277
databaseId: this.newPermission.database,
251-
userTypeId: this.newPermission.userType
278+
userTypeId: this.newPermission.userType,
279+
userIsPrimaryContact: this.newPermission.userIsPrimaryContact
252280
}
253281
254282
this.apiPostUserPermission(toSend, result => {
@@ -273,4 +301,7 @@ export default {
273301
</script>
274302

275303
<style>
304+
.form-checkbox .custom-control-label {
305+
margin-left: 0.5rem !important;
306+
}
276307
</style>

0 commit comments

Comments
 (0)