Skip to content

Commit 2c3a825

Browse files
feat: read calendar ACL properly
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
1 parent 8210ee3 commit 2c3a825

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/mixins/EditorMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export default {
195195
return true
196196
}
197197

198-
return calendar.readOnly
198+
return !calendar.canCreateObject && !calendar.canModifyObject
199199
},
200200
isSharedWithMe() {
201201
if (!this.calendarObject) {

src/models/calendar.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ function getDefaultCalendarObject(props = {}) {
4848
canBeShared: false,
4949
// Whether or not the calendar can be published by me
5050
canBePublished: false,
51+
// Whether or not I can create objects in this calendar
52+
canCreateObject: false,
53+
// Whether or not I can modify objects in this calendar
54+
canModifyObject: false,
55+
// Whether or not I can delete objects in this calendar
56+
canDeleteObject: false,
5157
// Reference to cdav-lib object
5258
dav: false,
5359
// All calendar-objects from this calendar that have already been fetched
@@ -86,6 +92,9 @@ function mapDavCollectionToCalendar(calendar, currentUserPrincipal) {
8692
const readOnly = !calendar.isWriteable()
8793
const canBeShared = calendar.isShareable()
8894
const canBePublished = calendar.isPublishable()
95+
const canCreateObject = calendar.currentUserPrivilegeSet.includes('{DAV:}bind') || calendar.currentUserPrivilegeSet.includes('{DAV:}write') || calendar.currentUserPrivilegeSet.includes('{DAV:}all') === true
96+
const canModifyObject = calendar.currentUserPrivilegeSet.includes('{DAV:}write-content') || calendar.currentUserPrivilegeSet.includes('{DAV:}write') || calendar.currentUserPrivilegeSet.includes('{DAV:}all') === true
97+
const canDeleteObject = calendar.currentUserPrivilegeSet.includes('{DAV:}unbind') || calendar.currentUserPrivilegeSet.includes('{DAV:}write') || calendar.currentUserPrivilegeSet.includes('{DAV:}all') === true
8998
const order = calendar.order || 0
9099
const url = calendar.url
91100
const publishURL = calendar.publishURL || null
@@ -146,6 +155,9 @@ function mapDavCollectionToCalendar(calendar, currentUserPrincipal) {
146155
publishURL,
147156
canBeShared,
148157
canBePublished,
158+
canCreateObject,
159+
canModifyObject,
160+
canDeleteObject,
149161
shares,
150162
timezone,
151163
transparency,

0 commit comments

Comments
 (0)