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