Auth: Ensure only users with full access can open batch edit #271 #5324

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2025-11-17 12:17:41 +01:00
parent b97809589e
commit 93183fbd21
2 changed files with 10 additions and 9 deletions

View file

@ -77,7 +77,7 @@ export default {
// Opens the photo edit dialog (when more than 1 image are selected).
this.subscriptions.push(
this.$event.subscribe("dialog.editBatch", (ev, data) => {
this.$event.subscribe("dialog.batchedit", (ev, data) => {
this.onEditBatch(data);
})
);
@ -120,12 +120,12 @@ export default {
this.edit.visible = true;
},
onEditBatch(data) {
if (this.editBatch.visible || !this.hasAuth()) {
if (this.batchedit.visible || !this.hasAuth()) {
return;
}
this.editBatch.selection = data.selection;
this.editBatch.visible = true;
this.batchedit.selection = data.selection;
this.batchedit.visible = true;
},
closeEditDialog() {
if (this.edit.visible) {
@ -133,8 +133,8 @@ export default {
}
},
closeEditBatch() {
if (this.editBatch.visible) {
this.editBatch.visible = false;
if (this.batchedit.visible) {
this.batchedit.visible = false;
}
},
onUpload(data) {

View file

@ -227,6 +227,7 @@ export default {
canManage: this.$config.allow("photos", "manage") && features.albums,
canEdit: this.$config.allow("photos", "update") && features.edit,
canEditAlbum: this.$config.allow("albums", "update") && features.albums,
canBatchEdit: this.$config.allow("photos", "update") && this.$config.allow("photos", "access_all"),
busy: false,
config: this.$config.values,
expanded: false,
@ -424,11 +425,11 @@ export default {
download(path, "photos.zip");
},
edit() {
// Open Edit Dialog
if (this.selection.length == 1) {
// Open Edit or Batch Edit Dialog.
if (!this.canBatchEdit || this.selection.length === 1) {
this.$event.PubSub.publish("dialog.edit", { selection: this.selection, album: this.album, index: 0 });
} else {
this.$event.PubSub.publish("dialog.editBatch", { selection: this.selection, album: this.album, index: 0 });
this.$event.PubSub.publish("dialog.batchedit", { selection: this.selection, album: this.album, index: 0 });
}
},
onShared() {