All Classes Files Functions Variables Enumerations Enumerator Groups Pages
MailingLists.idl
Go to the documentation of this file.
1 /**
2  * @file MailingLists.idl
3  * @brief Work with mailing lists, the groups of email addresses and the ability to archive the electronic communication.
4  *
5  * @author Dusan Juhas
6  *
7  * @copyright Copyright © 2017 Kerio Technologies s.r.o.
8  */
9 
10 #import <kerio/web/idl/SharedStructures.idl>
11 #import <AdminStructures.idl> //DataSource
12 #import <DistributedDomain.idl> //HomeServer
13 
14 module kerio {
15 module jsonapi {
16 module admin {
17 
18 /**
19  * Mailing List (=ML) Action Access Right Type
20  */
21 enum MlPermission {
22  Allowed, ///< certain action is allowed
23  Moderated, ///< certain action must be approved by moderator
24  Denied ///< certain action is denied
25 };
26 
27 /**
28  * Moderator Posting Access Right Type
29  */
30 enum ModeratorPermission {
31  PostAllowed, ///< certain action is allowed
32  PostModerated, ///< certain action must be approved by moderator
33  PostAccordingMembership ///< certain action is ruled according modarator membership
34 };
35 
36 /**
37  * ML Addressee Type
38  */
39 enum MlReplyTo {
40  Sender, ///< email address of the sender
41  ThisList, ///< email address of the ML
42  OtherAddress, ///< the address of the original sender will be substituted by a user defined email address
43  SenderThisList ///< Sender + ThisList
44 };
45 
46 /**
47  * Type of Mailing List Membership
48  */
49 enum MlMembership {
50  Member, ///< obtains contributions
51  Moderator ///< can manipulate with members but does not obtain contributions
52 };
53 
54 /**
55  * ML member
56  */
57 struct UserOrEmail {
58  boolean hasId; ///< is a real user or email address only?
59  kerio::web::KId userId; ///< global user identification
60  string emailAddress; ///< email address, filled only if hasId is false
61  string fullName; ///< fullName of user or associated email
62  MlMembership kind; ///< a kind of membership
63 };
64 
65 /**
66  * A ML member being imported from CSV file.
67  */
69  UserOrEmail member; ///< ML member data
70  boolean isImportable; ///< ML member can be imported
71  string message; ///< error message if ML member is not importable
72 };
73 
74 typedef sequence<MLMemberImportee> MLMemberImporteeList;
75 
76 /**
77  * List of ML members
78  */
79 typedef sequence<UserOrEmail> UserOrEmailList;
80 
81 /**
82  * type indicator
83  */
84 enum TrusteeKind {
85  TrusteeUser, // the type is the user
86  TrusteeGroup // the type is the group
87 };
88 
89 /**
90  * Entities that have access rights to read ML archive
91  */
92 struct Trustee {
93  TrusteeKind kind; ///< is user or group?
94  kerio::web::KId readerId; ///< group or user KId
95  string displayString; ///< login name or group name with domain name
96  boolean isEnabled; ///< true if user account is enabled
97  DataSource itemSource; ///< internal/LDAP
98 };
99 
100 /**
101  * List of entities that have access rights to read ML archive
102  */
103 typedef sequence<Trustee> TrusteeList;
104 
105 /**
106  * Trustee target can be user or group
107  */
109  kerio::web::KId id; ///< unique identifier
110  TrusteeKind type; ///< is user or group?
111  string name; ///< loginName for the User, name in square brackets for the Group
112  string fullName; ///< fullname for the User, empty string for the Group
113  string description; ///< description of User/Group
114  boolean isEnabled; ///< is the User/Group enabled?
115  DataSource itemSource; ///< is the User/Group stored internally or by LDAP?
116  HomeServer homeServer; ///< id of users homeserver if server is in Cluster; groups haven't homeserver
117 };
118 
119 /**
120  * List of trustee targets
121  */
122 typedef sequence<TrusteeTarget> TrusteeTargetList;
123 
124 /**
125  * Rules for subscription
126  */
128  MlPermission type;
129  boolean moderatorReview;
130  boolean moderatorNotification;
131 };
132 
133 /**
134  * Rules for posting
135  */
137  MlPermission memberPosting; ///< posting policy for ML member(s)
138  MlPermission nonMemberPosting; ///< posting policy for ML non-member(s)
139  ModeratorPermission moderatorPosting; ///< posting policy for ML moderator(s)
140  boolean userPostingNotification; ///< notify user that the posting will be reviewed by a moderator
141  boolean sendErrorsToModerator; ///< send delivery errors to moderator(s)
142 };
143 
144 /**
145  * How is the archive organized?
146  */
148  boolean keepArchive; ///< maintain archive
149  boolean archiveOnlyForLogged; ///< the archive is available for logged users only
150  TrusteeList archiveReaderList; ///< list of archive readers, can be either user or group, meaningful only if onlyForLogged is true
151 };
152 
153 /**
154  * Mailing List Structure
155  */
156 struct Ml {
157  kerio::web::KId id; ///< [READ-ONLY] global identification of ML
158  kerio::web::KId domainId; ///< [REQUIRED FOR CREATE] [WRITE-ONCE] identification in which domain ML exists
159  string name; ///< [REQUIRED FOR CREATE] [WRITE-ONCE] ML name, name@domain is email address
160  string description; ///< description
161  kerio::web::KId languageId; ///< language to be spoken withing mailing list
162  string welcomeString; ///< string to be sent as welcome of a new memeber
163  string footerString; ///< string to be sent as footer of each contribution
164  SubscriptionPolicy subscription; ///< type of ML subscription policy
165  PostingPolicy posting; ///< type of ML posting policy
166  MlReplyTo replyTo; ///< how should be replied to
167  string otherAddress; ///< if replyTo is OtherAddress, it contains email address
168  string subjectPrefix; ///< prefix for each subject
169  boolean hideSenderAddress; ///< replace sender's email address by ML address
170  boolean allowEmptySubject; ///< allow posting with empty subject
171  ArchiveSettings archive; ///< archive settings
172 
173  long membersCount; ///< [READ-ONLY] Number of members.
174  HomeServer homeServer; ///< [READ-ONLY] Id of users homeserver if server is in Cluster
175 };
176 
177 /**
178  * List of mailing lists
179  */
180 typedef sequence<Ml> MlList;
181 
182 interface MailingLists {
183 
184  /**
185  * Add one or more members/moderators to a mailing list.
186  *
187  * @param errors - appropriate error messages
188  * @param members - ML members and/or moderators
189  * @param mlId - unique ML identifier
190  */
191  void addMlUserList(out kerio::web::ErrorList errors, in UserOrEmailList members, in kerio::web::KId mlId);
192 
193  /**
194  * Create new mailing lists.
195  *
196  * @param errors - error message list
197  * @param result - list of IDs of created mailing lists
198  * @param mailingLists - mailing list entities
199  */
200  void create(out kerio::web::ErrorList errors, out kerio::web::CreateResultList result, in MlList mailingLists);
201 
202  /**
203  * Export of mailing list users of specified membership type.
204  *
205  * @param kind - membership type
206  * @param mlId - unique ML identifier
207  * @param fileDownload - description of output file
208  */
209  void exportMlUsersToCsv(out kerio::web::Download fileDownload, in MlMembership kind, in kerio::web::KId mlId);
210 
211  /**
212  * Obtain a list of mailing lists.
213  *
214  * @param list - mailing lists
215  * @param totalItems - amount of MLs for given search condition, useful when a limit is defined in search query
216  * @param query - query conditions and limits
217  * @param domainName - domain identification
218  */
219  void get(out MlList list, out long totalItems, in kerio::web::SearchQuery query, in kerio::web::KId domainId);
220 
221  /**
222  * Obtain list of mailing list users including membership type.
223  *
224  * @param list - mailing list members and/or moderators
225  * @param totalItems - amount of MLs members for given search condition, useful when a limit is defined in search query
226  * @param query - orderBy definition (conditions and limit are ignored)
227  * @param mlId - unique ML identifier
228  */
229  void getMlUserList(out UserOrEmailList list, out long totalItems, in kerio::web::SearchQuery query, in kerio::web::KId mlId);
230 
231  /**
232  * Parse CSV file in format 'Email, FullName' and return list of members.
233  *
234  * @param members - ML members and/or moderators
235  * @param fileId - ID of the uploaded file
236  * @param mlToImport - unique ML identifier or empty string if XML does not exist yet
237  */
238  void getMlUserListFromCsv(out MLMemberImporteeList members, in string fileId, in kerio::web::KId mlToImport);
239 
240  /**
241  * Obtain all suffixes of mailing list. These are forbidden in a name of mailing list to avoid of misbehaviour during
242  * processing of special commands of mailing list.
243  *
244  * @param suffixes - list of suffixes
245  */
246  void getSuffixes(out kerio::web::StringList suffixes);
247 
248  /**
249  * Obtain a list of potential mailing list archive rights targets.
250  *
251  * @param list - trustee targets
252  * @param query - query attributes and limits
253  * @param domain - domain restriction
254  */
255  void getTrusteeTargetList(out TrusteeTargetList list, out long totalItems, in kerio::web::SearchQuery query, in kerio::web::KId domainId);
256 
257  /**
258  * Remove mailing lists.
259  *
260  * @param errors - error message list
261  * @param mlIds - list of global identifiers of MLs to be deleted
262  */
263  void remove(out kerio::web::ErrorList errors, in kerio::web::KIdList mlIds);
264 
265  /**
266  * Remove member(s)/moderator(s) from a mailing list.
267  *
268  * @param errors - appropriate error messages
269  * @param members - ML members and/or moderators
270  * @param mlId - unique ML identifier
271  */
272  void removeMlUserList(out kerio::web::ErrorList errors, in UserOrEmailList members, in kerio::web::KId mlId);
273 
274  /**
275  * Create a new mailing list.
276  *
277  * @param errors - error message list
278  * @param mlIds - ML global identifiers
279  * @param pattern - pattern to use for new values
280  */
281  void set(out kerio::web::ErrorList errors, in kerio::web::KIdList mlIds, in Ml pattern);
282 };
283 
284 }; }; };//end of namespace