1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var EXPORTED_SYMBOLS = ["CalDefaultACLManager"];
var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
function CalDefaultACLManager() {
this.mCalendarEntries = {};
}
CalDefaultACLManager.prototype = {
QueryInterface: ChromeUtils.generateQI(["calICalendarACLManager"]),
classID: Components.ID("{7463258c-6ef3-40a2-89a9-bb349596e927}"),
mCalendarEntries: null,
/* calICalendarACLManager */
_getCalendarEntryCached(aCalendar) {
let calUri = aCalendar.uri.spec;
if (!(calUri in this.mCalendarEntries)) {
this.mCalendarEntries[calUri] = new calDefaultCalendarACLEntry(this, aCalendar);
}
return this.mCalendarEntries[calUri];
},
getCalendarEntry(aCalendar, aListener) {
let entry = this._getCalendarEntryCached(aCalendar);
aListener.onOperationComplete(aCalendar, Cr.NS_OK, Ci.calIOperationListener.GET, null, entry);
},
getItemEntry(aItem) {
let calEntry = this._getCalendarEntryCached(aItem.calendar);
return new calDefaultItemACLEntry(calEntry);
},
};
function calDefaultCalendarACLEntry(aMgr, aCalendar) {
this.mACLManager = aMgr;
this.mCalendar = aCalendar;
}
calDefaultCalendarACLEntry.prototype = {
QueryInterface: ChromeUtils.generateQI(["calICalendarACLEntry"]),
mACLManager: null,
/* calICalendarACLCalendarEntry */
get aclManager() {
return this.mACLManager;
},
hasAccessControl: false,
userIsOwner: true,
userCanAddItems: true,
userCanDeleteItems: true,
_getIdentities() {
let identities = [];
cal.email.iterateIdentities(id => identities.push(id));
return identities;
},
getUserAddresses() {
let identities = this.getUserIdentities();
let addresses = identities.map(id => id.email);
return addresses;
},
getUserIdentities() {
let identity = cal.provider.getEmailIdentityOfCalendar(this.mCalendar);
if (identity) {
return [identity];
}
return this._getIdentities();
},
getOwnerIdentities() {
return this._getIdentities();
},
refresh() {},
};
function calDefaultItemACLEntry(aCalendarEntry) {
this.calendarEntry = aCalendarEntry;
}
calDefaultItemACLEntry.prototype = {
QueryInterface: ChromeUtils.generateQI(["calIItemACLEntry"]),
/* calIItemACLEntry */
calendarEntry: null,
userCanModify: true,
userCanRespond: true,
userCanViewAll: true,
userCanViewDateAndTime: true,
};
|