ask confirmation to grant SSH/SFTP permissions to a group

This commit is contained in:
axolotle 2021-04-16 22:35:55 +02:00
parent fc5f20b442
commit 87a5c12b54
3 changed files with 10 additions and 2 deletions

View file

@ -91,8 +91,9 @@
"confirm_app_default": "Are you sure you want to make this app default?",
"confirm_change_maindomain": "Are you sure you want to change the main domain?",
"confirm_delete": "Are you sure you want to delete {name}?",
"confirm_firewall_allow": "Are you sure you want to open port {port} (protocol: {protocol}, connection: {connection})",
"confirm_firewall_allow": "dAre you sure you want to open port {port} (protocol: {protocol}, connection: {connection})",
"confirm_firewall_disallow": "Are you sure you want to close port {port} (protocol: {protocol}, connection: {connection})",
"confirm_group_add_access_permission": "Are you sure you want to grant a {perm} access to your server to {name}'?",
"confirm_install_custom_app": "WARNING! Installing 3rd party applications may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. Are you willing to take that risk?",
"confirm_install_domain_root": "Are you sure you want to install this application on '/'? You will not be able to install any other app on {domain}",
"confirm_app_install": "Are you sure you want to install this application?",

View file

@ -199,8 +199,14 @@ export default {
})
},
onPermissionChanged ({ option, groupName, action, applyMethod }) {
async onPermissionChanged ({ option, groupName, action, applyMethod }) {
const permId = this.permissions.find(perm => perm.label === option).id
if (action === 'add' && ['sftp.main', 'ssh.main'].includes(permId)) {
const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_group_add_access_permission', { name: groupName, perm: option })
)
if (!confirmed) return
}
api.put(
// FIXME hacky way to update the store
{ uri: `users/permissions/${permId}/${action}/${groupName}`, storeKey: 'permissions', groupName, action, permId },

View file

@ -185,6 +185,7 @@ export default {
}
const actionTrad = this.$i18n.t({ allow: 'open', disallow: 'close' }[action])
console.log(action, actionTrad)
return api.put(
`firewall/${protocol}/${action}/${port}?${connection}_only`,
{},