Skip to content

Commit

Permalink
fix(files): Disable tags editing for shared files/folders with view o…
Browse files Browse the repository at this point in the history
…nly permission

Signed-off-by: Konstantin Myakshin <molodchick@gmail.com>
  • Loading branch information
Koc authored and AndyScherzinger committed Aug 9, 2024
1 parent dda6dd0 commit 81ee1ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/files/src/services/FileInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default async function(url) {
// TODO remove when no more legacy backbone is used
fileInfo.get = (key) => fileInfo[key]
fileInfo.isDirectory = () => fileInfo.mimetype === 'httpd/unix-directory'
fileInfo.canEdit = () => Boolean(fileInfo.permissions & OC.PERMISSION_UPDATE)

return fileInfo
}
1 change: 1 addition & 0 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<div class="sidebar__description">
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
v-show="showTags"
:disabled="!fileInfo?.canEdit()"
:file-id="fileInfo.id"
@has-tags="value => showTags = value" />
<LegacyView v-for="view in views"
Expand Down
5 changes: 5 additions & 0 deletions apps/systemtags/src/components/SystemTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:options="sortedTags"
:value="selectedTags"
:create-option="createOption"
:disabled="disabled"
:taggable="true"
:passthru="true"
:fetch-tags="false"
Expand Down Expand Up @@ -65,6 +66,10 @@ export default Vue.extend({
type: Number,
required: true,
},
disabled: {
type: Boolean,
default: false,
},
},
data() {
Expand Down

0 comments on commit 81ee1ce

Please sign in to comment.