forked from kaverti/website
Modify Team Roles
This commit is contained in:
parent
70fa581cff
commit
5539f6f77f
|
@ -17,6 +17,45 @@
|
|||
</style>
|
||||
<template>
|
||||
<main>
|
||||
<modal-window v-model='showRoleModifyModal' :loading='loading' style='z-index: 99; '>
|
||||
<div slot="header">
|
||||
Modifying {{role.name}} <b-tooltip class="is-info" label="From here you can modify a Team Role">
|
||||
<b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag>
|
||||
</b-tooltip>
|
||||
</div>
|
||||
<div slot='main' class="card-content">
|
||||
<div>
|
||||
Name of your role:
|
||||
<b-input maxlength="20" v-model="role.name"></b-input>
|
||||
<p>Permissions:</p>
|
||||
<b-switch type="is-info" v-model="role.administrator">
|
||||
Administrator
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="role.inviteUsers">
|
||||
Invite users
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="role.changeTeamMeta">
|
||||
Modify general Team settings
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="role.forumAdministrator">
|
||||
Modify Team Forum <b-tooltip class="is-info" label="Team forums are coming soon, you can set this for the future when they do release."><b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag></b-tooltip>
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="role.moderateForumThreads">
|
||||
Forum moderator <b-tooltip class="is-info" label="Team forums are coming soon, you can set this for the future when they do release. This role only allows people with the permission to delete threads and posts, not have access to forum settings"><b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag></b-tooltip>
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="role.submitTeamItems">
|
||||
Submit Marketplace items <b-tooltip class="is-info" label="Team Marketplace items are coming soon, you can set this for the future when they do release."><b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag></b-tooltip>
|
||||
</b-switch>
|
||||
<br>
|
||||
Please set a priority value <b-tooltip class="is-info" label="Priority values are how high the role is considered when taking actions and displaying users in some places. For example, the Admin role can be a priority of 1 (most important), and the Moderator role can be a priority of 2, etc"><b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag></b-tooltip>
|
||||
<br>
|
||||
<b-numberinput v-model="role.priority"></b-numberinput>
|
||||
</div>
|
||||
</div>
|
||||
<div slot='footer'>
|
||||
<button class='button is-info' :loading="role.loading" @click='updateRole(role)'>Add Role</button>
|
||||
</div>
|
||||
</modal-window>
|
||||
<modal-window v-model='showRoleModal' :loading='loading' style='z-index: 99; '>
|
||||
<div slot="header">
|
||||
Creating a role <b-tooltip class="is-info" label="From here you can create a Team Role">
|
||||
|
@ -31,6 +70,9 @@
|
|||
<b-switch type="is-info" v-model="tRole.administrator">
|
||||
Administrator
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="tRole.inviteUsers">
|
||||
Invite users
|
||||
</b-switch>
|
||||
<b-switch type="is-info" v-model="tRole.changeTeamMeta">
|
||||
Modify general Team settings
|
||||
</b-switch>
|
||||
|
@ -67,12 +109,12 @@
|
|||
<li
|
||||
class="list-group-item"
|
||||
v-for="role in roles"
|
||||
:key="role.priority"
|
||||
:key="role.id"
|
||||
>
|
||||
<i
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
<b-tag class="is-large">{{ role.name }} <b-tag @click="toggleRoleCreate"><i @click="toggleRoleCreate" class="fas fa-pencil"></i></b-tag></b-tag>
|
||||
<b-tag class="is-large">{{ role.name }} <b-tag @click="toggleModifyModal(role)"><i @click="toggleModifyModal(role)" class="fas fa-pencil"></i></b-tag></b-tag>
|
||||
</li>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
|
@ -114,6 +156,20 @@ export default {
|
|||
userRoles: [],
|
||||
roles: [],
|
||||
team: [],
|
||||
role: {
|
||||
name: '',
|
||||
id: '',
|
||||
|
||||
loading: false,
|
||||
administrator: false,
|
||||
inviteUsers: true,
|
||||
changeTeamMeta: false,
|
||||
forumAdministrator: false,
|
||||
moderateForumThreads: false,
|
||||
changeTeamPrivacy: false,
|
||||
submitTeamItems: false,
|
||||
priority: null
|
||||
},
|
||||
|
||||
loading: false,
|
||||
offset: 0,
|
||||
|
@ -122,8 +178,10 @@ export default {
|
|||
showRoleModal: false,
|
||||
createTeamModal: false,
|
||||
drag: false,
|
||||
showRoleModifyModal: false,
|
||||
tRole: {
|
||||
name: '',
|
||||
id: '',
|
||||
|
||||
loading: false,
|
||||
administrator: false,
|
||||
|
@ -158,6 +216,18 @@ export default {
|
|||
});
|
||||
this.roles = newList;
|
||||
},
|
||||
toggleModifyModal (role) {
|
||||
this.role.id = role.id
|
||||
this.role.name = role.name
|
||||
this.role.administrator = role.administrator
|
||||
this.role.priority = role.priority
|
||||
this.role.inviteUsers = role.inviteUsers
|
||||
this.role.changeTeamMeta = role.changeTeamMeta
|
||||
this.role.forumAdministrator = role.forumAdministrator
|
||||
this.role.moderateForumThreads = role.moderateForumThreads
|
||||
this.role.submitTeamItems = role.submitTeamItems
|
||||
this.showRoleModifyModal = true
|
||||
},
|
||||
saveRoles() {
|
||||
this.updateListSortOrder()
|
||||
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username, {
|
||||
|
@ -170,6 +240,26 @@ export default {
|
|||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
},
|
||||
updateRole(role) {
|
||||
this.role.loading = true
|
||||
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username + '/' + this.role.id, {
|
||||
name: role.name,
|
||||
|
||||
administrator: role.administrator,
|
||||
inviteUsers: role.inviteUsers,
|
||||
changeTeamMeta: role.changeTeamMeta,
|
||||
forumAdministrator: role.forumAdministrator,
|
||||
moderateForumThreads: role.moderateForumThreads,
|
||||
submitTeamItems: role.submitTeamItems,
|
||||
priority: role.priority
|
||||
}).then(() => {
|
||||
this.role.loading = false
|
||||
this.closeModifyModal()
|
||||
}).catch(e => {
|
||||
this.role.loading = false
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
},
|
||||
|
||||
clearTeamErrors() {
|
||||
this.tcreateProd.errors.username = ''
|
||||
|
@ -178,6 +268,9 @@ export default {
|
|||
closeAccountModal() {
|
||||
this.showRoleModal = false
|
||||
},
|
||||
closeModifyModal() {
|
||||
this.showRoleModifyModal = false
|
||||
},
|
||||
addRole() {
|
||||
this.tRole.loading = true
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||
}
|
||||
},
|
||||
len: {
|
||||
args: [3, 30],
|
||||
msg: 'Team name must be between 3 and 30 characters'
|
||||
args: [3, 20],
|
||||
msg: 'Team name must be between 3 and 20 characters'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue