filemanager: implement chown action

This commit is contained in:
Johannes Zellner
2023-04-17 17:51:19 +02:00
parent a8d2e6634f
commit 32302e89aa
4 changed files with 34 additions and 5 deletions
+24
View File
@@ -51,9 +51,11 @@
@item-activated="onItemActivated"
:delete-handler="deleteHandler"
:rename-handler="renameHandler"
:change-owner-handler="changeOwnerHandler"
:copy-handler="copyHandler"
:cut-handler="cutHandler"
:items="items"
:owners-model="ownersModel"
/>
</div>
<div class="main-view-col" style="max-width: 300px;">
@@ -136,6 +138,19 @@ export default {
busy: false,
name: ''
},
ownersModel: [{
uid: 0,
label: 'root'
}, {
uid: 33,
label: 'www-data'
}, {
uid: 1000,
label: 'cloudron'
}, {
uid: 1001,
label: 'git'
}],
// contextMenuModel will have activeItem attached if any command() is called
createMenuModel: [{
label: 'File',
@@ -234,6 +249,15 @@ export default {
await this.directoryModel.rename(buildFilePath(this.cwd, file.name), sanitize(this.cwd + '/' + newName));
await this.loadCwd();
},
async changeOwnerHandler(files, newOwnerUid) {
if (!files) return;
for (let i in files) {
await this.directoryModel.chown(buildFilePath(this.cwd, files[i].name), newOwnerUid);
}
await this.loadCwd();
},
async copyHandler(files) {
if (!files) return;