|
40 | 40 | ref="canEdit" |
41 | 41 | :checked.sync="canEdit" |
42 | 42 | :value="permissionsEdit" |
43 | | - :disabled="saving"> |
| 43 | + :disabled="saving || !canSetEdit"> |
44 | 44 | {{ t('files_sharing', 'Allow editing') }} |
45 | 45 | </ActionCheckbox> |
46 | 46 |
|
|
50 | 50 | ref="canCreate" |
51 | 51 | :checked.sync="canCreate" |
52 | 52 | :value="permissionsCreate" |
53 | | - :disabled="saving"> |
| 53 | + :disabled="saving || !canSetCreate"> |
54 | 54 | {{ t('files_sharing', 'Allow creating') }} |
55 | 55 | </ActionCheckbox> |
56 | 56 |
|
|
60 | 60 | ref="canDelete" |
61 | 61 | :checked.sync="canDelete" |
62 | 62 | :value="permissionsDelete" |
63 | | - :disabled="saving"> |
| 63 | + :disabled="saving || !canSetDelete"> |
64 | 64 | {{ t('files_sharing', 'Allow deleting') }} |
65 | 65 | </ActionCheckbox> |
66 | 66 |
|
|
69 | 69 | ref="canReshare" |
70 | 70 | :checked.sync="canReshare" |
71 | 71 | :value="permissionsShare" |
72 | | - :disabled="saving"> |
| 72 | + :disabled="saving || !canSetReshare"> |
73 | 73 | {{ t('files_sharing', 'Allow resharing') }} |
74 | 74 | </ActionCheckbox> |
75 | 75 |
|
@@ -216,6 +216,54 @@ export default { |
216 | 216 | && this.share.type !== this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP |
217 | 217 | }, |
218 | 218 |
|
| 219 | + /** |
| 220 | + * Can the sharer set whether the sharee can edit the file ? |
| 221 | + * |
| 222 | + * @returns {boolean} |
| 223 | + */ |
| 224 | + canSetEdit() { |
| 225 | + // If the owner revoked the permission after the resharer granted it |
| 226 | + // the share still has the permission, and the resharer is still |
| 227 | + // allowed to revoke it too (but not to grant it again). |
| 228 | + return (this.fileInfo.sharePermissions & OC.PERMISSION_UPDATE) || this.canEdit |
| 229 | + }, |
| 230 | +
|
| 231 | + /** |
| 232 | + * Can the sharer set whether the sharee can create the file ? |
| 233 | + * |
| 234 | + * @returns {boolean} |
| 235 | + */ |
| 236 | + canSetCreate() { |
| 237 | + // If the owner revoked the permission after the resharer granted it |
| 238 | + // the share still has the permission, and the resharer is still |
| 239 | + // allowed to revoke it too (but not to grant it again). |
| 240 | + return (this.fileInfo.sharePermissions & OC.PERMISSION_CREATE) || this.canCreate |
| 241 | + }, |
| 242 | +
|
| 243 | + /** |
| 244 | + * Can the sharer set whether the sharee can delete the file ? |
| 245 | + * |
| 246 | + * @returns {boolean} |
| 247 | + */ |
| 248 | + canSetDelete() { |
| 249 | + // If the owner revoked the permission after the resharer granted it |
| 250 | + // the share still has the permission, and the resharer is still |
| 251 | + // allowed to revoke it too (but not to grant it again). |
| 252 | + return (this.fileInfo.sharePermissions & OC.PERMISSION_DELETE) || this.canDelete |
| 253 | + }, |
| 254 | +
|
| 255 | + /** |
| 256 | + * Can the sharer set whether the sharee can reshare the file ? |
| 257 | + * |
| 258 | + * @returns {boolean} |
| 259 | + */ |
| 260 | + canSetReshare() { |
| 261 | + // If the owner revoked the permission after the resharer granted it |
| 262 | + // the share still has the permission, and the resharer is still |
| 263 | + // allowed to revoke it too (but not to grant it again). |
| 264 | + return (this.fileInfo.sharePermissions & OC.PERMISSION_SHARE) || this.canReshare |
| 265 | + }, |
| 266 | +
|
219 | 267 | /** |
220 | 268 | * Can the sharee edit the shared file ? |
221 | 269 | */ |
|
0 commit comments