4444 class =" sharing-entry__actions"
4545 @close =" onMenuClose" >
4646 <template v-if =" share .canEdit " >
47- <!-- edit permission -->
48- <ActionCheckbox
49- ref =" canEdit"
50- :checked.sync =" canEdit"
51- :value =" permissionsEdit"
52- :disabled =" saving || !canSetEdit" >
53- {{ t('files_sharing', 'Allow editing') }}
54- </ActionCheckbox >
47+ <!-- folder -->
48+ <template v-if =" isFolder && config .isPublicUploadEnabled " >
5549
56- <!-- create permission -->
57- <ActionCheckbox
58- v-if =" isFolder"
59- ref =" canCreate"
60- :checked.sync =" canCreate"
61- :value =" permissionsCreate"
62- :disabled =" saving || !canSetCreate" >
63- {{ t('files_sharing', 'Allow creating') }}
64- </ActionCheckbox >
50+ <ActionRadio :checked =" sharePermissions === publicUploadRValue"
51+ :value =" publicUploadRValue"
52+ :name =" randomId"
53+ :disabled =" saving"
54+ @change =" togglePermissions" >
55+ {{ t('files_sharing', 'Read only') }}
56+ </ActionRadio >
6557
66- <!-- delete permission -->
67- <ActionCheckbox
68- v-if =" isFolder"
69- ref =" canDelete"
70- :checked.sync =" canDelete"
71- :value =" permissionsDelete"
72- :disabled =" saving || !canSetDelete" >
73- {{ t('files_sharing', 'Allow deleting') }}
74- </ActionCheckbox >
58+ <ActionRadio :checked =" sharePermissions === publicUploadRWValue"
59+ :value =" publicUploadRWValue"
60+ :disabled =" saving"
61+ :name =" randomId"
62+ @change =" togglePermissions" >
63+ {{ t('files_sharing', 'Allow upload and editing') }}
64+ </ActionRadio >
65+
66+ </template >
67+ <!-- file -->
68+ <template v-else >
69+ <ActionRadio :checked =" sharePermissions === publicUploadRValue"
70+ :value =" publicUploadRValue"
71+ :name =" randomId"
72+ :disabled =" saving"
73+ @change =" togglePermissions" >
74+ {{ t('files_sharing', 'Read only') }}
75+ </ActionRadio >
76+
77+ <ActionRadio :checked =" sharePermissions === publicUploadEValue"
78+ :value =" publicUploadEValue"
79+ :disabled =" saving"
80+ :name =" randomId"
81+ @change =" togglePermissions" >
82+ {{ t('files_sharing', 'Editing') }}
83+ </ActionRadio >
84+ </template >
7585
7686 <!-- reshare permission -->
7787 <ActionCheckbox
8494 </ActionCheckbox >
8595
8696 <!-- expiration date -->
87- <ActionCheckbox :checked.sync =" hasExpirationDate"
97+ <ActionCheckbox
98+ v-if =" canHaveExpirationDate"
99+ :checked.sync =" hasExpirationDate"
88100 :disabled =" config.isDefaultInternalExpireDateEnforced || saving"
89101 @uncheck =" onExpirationDisable" >
90102 {{ config.isDefaultInternalExpireDateEnforced
149161import Avatar from ' @nextcloud/vue/dist/Components/Avatar'
150162import Actions from ' @nextcloud/vue/dist/Components/Actions'
151163import ActionButton from ' @nextcloud/vue/dist/Components/ActionButton'
164+ import ActionRadio from ' @nextcloud/vue/dist/Components/ActionRadio'
152165import ActionCheckbox from ' @nextcloud/vue/dist/Components/ActionCheckbox'
153166import ActionInput from ' @nextcloud/vue/dist/Components/ActionInput'
154167import ActionTextEditable from ' @nextcloud/vue/dist/Components/ActionTextEditable'
@@ -162,6 +175,7 @@ export default {
162175 components: {
163176 Actions,
164177 ActionButton,
178+ ActionRadio,
165179 ActionCheckbox,
166180 ActionInput,
167181 ActionTextEditable,
@@ -181,10 +195,34 @@ export default {
181195 permissionsDelete: OC .PERMISSION_DELETE ,
182196 permissionsRead: OC .PERMISSION_READ ,
183197 permissionsShare: OC .PERMISSION_SHARE ,
198+
199+ publicUploadRWValue: OC .PERMISSION_UPDATE | OC .PERMISSION_CREATE | OC .PERMISSION_READ | OC .PERMISSION_DELETE ,
200+ publicUploadRValue: OC .PERMISSION_READ ,
201+ publicUploadWValue: OC .PERMISSION_CREATE | OC .PERMISSION_READ ,
202+ publicUploadEValue: OC .PERMISSION_UPDATE | OC .PERMISSION_READ ,
184203 }
185204 },
186205
187206 computed: {
207+ /**
208+ * Return the current share permissions
209+ * We always ignore the SHARE permission as this is used for the
210+ * federated sharing.
211+ * @returns {number}
212+ */
213+ sharePermissions () {
214+ return this .share .permissions & ~ OC .PERMISSION_SHARE
215+ },
216+ /**
217+ * Generate a unique random id for this SharingEntryLink only
218+ * This allows ActionRadios to have the same name prop
219+ * but not to impact others SharingEntryLink
220+ * @returns {string}
221+ */
222+ randomId () {
223+ return Math .random ().toString (27 ).substr (2 )
224+ },
225+
188226 title () {
189227 let title = this .share .shareWithDisplayName
190228 if (this .share .type === this .SHARE_TYPES .SHARE_TYPE_GROUP ) {
@@ -398,6 +436,17 @@ export default {
398436 this .queueUpdate (' permissions' )
399437 },
400438
439+ /**
440+ * On permissions change
441+ * @param {Event} event js event
442+ */
443+ togglePermissions (event ) {
444+ const permissions = parseInt (event .target .value , 10 )
445+ | (this .canReshare ? this .permissionsShare : 0 )
446+ this .share .permissions = permissions
447+ this .queueUpdate (' permissions' )
448+ },
449+
401450 /**
402451 * Save potential changed data on menu close
403452 */
0 commit comments