All Classes Files Functions Variables Enumerations Enumerator Groups Pages
Users.idl
Go to the documentation of this file.
1 /**
2  * @file Users.idl
3  * @brief Work with user accounts as an representation of physical email boxes.
4  *
5  * @author Dusan Juhas, Martin Kuchar
6  *
7  * @copyright Copyright © 2017 Kerio Technologies s.r.o.
8  */
9 
10 #import <kerio/web/idl/SharedStructures.idl>
11 #import <AdminStructures.idl> //ActionAfterDays
12 #import <common.idl> //DateTimeStamp
13 #import <ContactsCommon.idl>
14 #import <DistributedDomain.idl> //HomeServer
15 #import <MobileCommon.idl>
16 
17 module kerio {
18 module jsonapi {
19 module admin {
20 
21 struct PublicFolder {
22  kerio::web::KId id;
23  string name;
24 };
25 
26 typedef sequence<PublicFolder> PublicFolderList;
27 
28 /**
29  * List of email addresses
30  */
31 typedef sequence<string> UserEmailAddressList;
32 
33 /**
34  * Export format type.
35  */
36 enum FileFormatType {
37  TypeXml, ///< Extensible Markup Language
38  TypeCsv ///< Comma Separated Values
39 };
40 
41 /**
42  * Type of user role.
43  */
44 enum UserRoleType {
45  UserRole, ///< regular user without any administration rights
46  Auditor, ///< read only access to administration
47  AccountAdmin, ///< can administer Users,Groups,Aliases,MLs
48  FullAdmin, ///< unlimited administration
49  BuiltInAdmin, ///< BuiltIn admin role can be returned only in Session::WhoAmI method for built-in administrator. This role must NOT be assigned.
50  BuiltInDomainAdmin ///< BuiltIn domain admin role can be returned only in Session::WhoAmI method for built-in domain administrator. This role must NOT be assigned.
51 };
52 
53 /**
54  *
55  * Note: all fields must be assigned if used in set methods.
56  */
57 struct UserRight {
58  UserRoleType userRole;
59  boolean publicFolderRight;
60  boolean archiveFolderRight;
61 };
62 
63 /**
64  * Forwarding setup for user.
65  */
66 enum UserForwardMode {
67  UForwardNone, ///< Forwarding is disabled
68  UForwardYes, ///< Forward all messages for this user to some addresses, don't deliver the message to the mailbox.
69  UForwardDeliver ///< Forward all messages for this user to some addresses, and also deliver the message to user's mailbox.
70 };
71 
72 /**
73  * Type of deleting folder of the user
74  */
75 enum UserDeleteFolderMode {
76  UDeleteUser, ///< Delete user without deleting his folder.
77  UDeleteFolder, ///< Delete user and delete his folder.
78  UMoveFolder ///< Delete user and his folder will move into another user's folder.
79 };
80 
81 /**
82  * Settings of email forwarding.
83  * Note: all fields must be assigned if used in set methods.
84  */
86  UserForwardMode mode;
87  UserEmailAddressList emailAddresses; ///< list of email addresses, make sense only for UForwardDeliver
88 };
89 
90 /**
91  * Properties of user's groups.
92  */
93 struct UserGroup {
94  kerio::web::KId id; ///< global identification
95  string name;
96  string description;
97  DataSource itemSource;
98 };
99 
100 /**
101  * List of user's groups.
102  */
103 typedef sequence<UserGroup> UserGroupList;
104 
105 /**
106  * Settings of items limit.
107  * Note: all fields must be assigned if used in set methods.
108  */
110  boolean isActive;
111  long limit;
112 };
113 
114 /**
115  * Amount of storage used and items currently stored in user's store.
116  */
117 struct QuotaUsage {
118  long items;
120 };
121 
122 /**
123  * List of QuotaUsage.
124  */
125 typedef sequence<QuotaUsage> QuotaUsageList;
126 
127 /**
128  * Last login information.
129  */
130 struct LastLogin {
131  DateTimeStamp dateTime; ///< date and time of last login
132  string protocol; ///< protocol name of last login, example POP3
133 };
134 
135 /**
136  * Per-user message retention policy.
137  */
138 struct CleanOut {
139  boolean isUsedDomain; ///< use domain settings
140  ActionAfterDays deletedItems; ///< clean Deleted Items folder (maximum: 24855)
141  ActionAfterDays junkEmail; ///< clean Junk Email folder (maximum: 24855)
142  ActionAfterDays sentItems; ///< clean Sent Items folder (maximum: 24855)
143  ActionAfterDays autoDelete; ///< clean all folders (maximum: 24855)
144 };
145 
146 /**
147  * User details.
148  */
149 struct User {
150  kerio::web::KId id; ///< [READ-ONLY] global identification
151  kerio::web::KId domainId; ///< [REQUIRED FOR CREATE] ID of domain where user belongs to
152  kerio::web::KId companyContactId; ///< ID of company contact associated with this user
153 
154  string loginName; ///< [REQUIRED FOR CREATE] [USED BY QUICKSEARCH] loginName name
155  string fullName; ///< [USED BY QUICKSEARCH]
156  string description; ///< [USED BY QUICKSEARCH]
157  boolean isEnabled; ///< user account is enabled/disabled
158  DataSource itemSource; ///< is user stored internally or by LDAP? This field cannot be used with Or queries.
159  UserAuthType authType; ///< supported values must be retrieved from engine by ServerInfo::getSupportedAuthTypes()
160  string password; ///< [WRITE-ONLY]
161  boolean isPasswordReversible; ///< typically triple DES
162  boolean allowPasswordChange; ///< if it is set to false the password can be changed only by the administrator
163  boolean hasDefaultSpamRule; ///< now: available only on user creation
164 
165  UserRight role; ///< user role
166  UserRight groupRole; ///< the mightiest user role obtained via group membership
167  UserRight effectiveRole; ///< the mightiest user role from role and groupRole
168  boolean isWritableByMe; ///< Does caller have right to change the user? E.g. if Account Admin gets User structure for Full Admin, isWritableByMe will be false. This field is read-only and cannot be used in kerio::web::SearchQuery conditions.
169 
170  UserEmailAddressList emailAddresses; ///< List of user email addresses. His default one (loginName@domain) is not listed here
171  EmailForwarding emailForwarding; ///< email forwarding setting
172  UserGroupList userGroups; ///< groups membership
173  ItemCountLimit itemLimit; ///< max. number of items
174  kerio::web::SizeLimit diskSizeLimit; ///< max. disk usage
175  long consumedItems; ///< current items used
177  boolean hasDomainRestriction; ///< user can send/receive from/to his/her domain only
178  kerio::web::SizeLimit outMessageLimit; ///< limit of outgoing message
179  LastLogin lastLoginInfo; ///< information about last login datetime and protocol
180  boolean publishInGal; ///< publish user in global address list? Default is true - the user will be published in Global Address Book.
181  CleanOut cleanOutItems; ///< Items clean-out settings
182  IdEntity accessPolicy; ///< ID and name of Access Policy applied for user. Only ID is writable.
183 
184  HomeServer homeServer; ///< [WRITE-ONCE] Id of user's homeserver if server is in a distributed domain.
185  kerio::web::OptionalEntity migration; ///< [READ-ONLY] migration.enabled is true if user's store is just being migrated and migration.id contains migration task id
186 };
187 
188 /**
189  * List of users.
190  */
191 typedef sequence<User> UserList;
192 
193 /**
194 * User effective rights (inherited from groups)
195 */
197  kerio::web::KId userId; ///< [READ-ONLY] global identification
198  boolean hasDomainRestriction; ///< user can send/receive from/to his/her domain only
199 };
200 
201 /**
202  * List of users effective rights
203  */
204 typedef sequence<EffectiveUserRights> EffectiveUserRightsList;
205 
206 /**
207  * Type of user directory
208  */
209 enum ServerDirectoryType {
210  WinNT, ///< Windows NT Domain directory (Win NT 4.0)
211  ActiveDirectory, ///< Active Directory (Windows 2000 and newer)
212  NovellEDirectory ///< Novell eDirectory
213 };
214 
215 /**
216  * Properties of the server from which users are imported.
217  */
218 struct ImportServer {
219  ServerDirectoryType directoryType;
220  string remoteDomainName;
221  string address; ///< server IP or FQDN
222  string loginName;
223  string password;
224  string ldapFilter;
225  boolean isSecureConnection;
226 };
227 
228 /**
229  * Login statistics - count and timestamp of the last login.
230  */
231 struct LoginStats {
232  long count;
233  string lastLogin;
234 };
235 
236 /**
237  * Statistics about user's usage of quota, logins to different services.
238  */
239 struct UserStats {
240  string name; ///< user's loginName
241  QuotaUsage occupiedSpace;
242  LoginStats pop3;
243  LoginStats securePop3;
244  LoginStats imap;
245  LoginStats secureImap;
246  LoginStats http;
247  LoginStats secureHttp;
248  LoginStats ldap;
249  LoginStats secureLdap;
250  LoginStats nntp;
251  LoginStats secureNntp;
252  LoginStats activeSync;
253  LoginStats secureActiveSync;
254  LoginStats xmpp;
255  LoginStats secureXmpp;
256 };
257 
258 /**
259  * List of users' statistics.
260  */
261 typedef sequence<UserStats> UserStatList;
262 
263 /**
264  * Result of a mass operation.
265  */
267  long inputIndex;
268  long itemsCount;
269 };
270 
271 /**
272  * List of mass operation results.
273  */
274 typedef sequence<ResultTriplet> ResultTripletList;
275 
276 /**
277  * User to be removed, what to do with his/her mailbox.
278  */
280  kerio::web::KId userId; ///< ID of user to be removed
281  UserDeleteFolderMode method; ///< removal method
282  boolean removeReferences; ///< if true all reference to this user is going to be removed as well
283  kerio::web::KId targetUserId; ///< applicable only when moving user's store to another user, use empty string if not moving user's messages to target mailbox
284  DirectoryServiceDeleteMode mode; ///< delete mode
285 };
286 
287 typedef sequence<RemovalRequest> RemovalRequestList;
288 
289 /**
290  * A user being imported from directory server.
291  */
292 struct Importee {
293  User userItem; ///< user data
294  boolean isImportable; ///< [READ-ONLY] user can be imported
295  string message; ///< [READ-ONLY] error message if user is not importable
296 };
297 
298 typedef sequence<Importee> ImporteeList;
299 
300 struct MailboxCount {
301  long active; ///< the number of active mailboxes on server
302  long total; ///< the number of created users on server
303 };
304 
305 /**
306  * Resut of autentication.
307  */
308 enum AuthResult {
309  AuthOK, ///< User was autenticated
310  AuthFail, ///< Wrong login name or password.
311  AuthUserDisabled, ///< User cannot to log in, because his account is disabled.
312  AuthLicense, ///< User cannot log in, because license limit was reached.
313  AuthDenied, ///< User is denied to log in.
314  AuthTryLater ///< User cannot to log in at this moment, try later.
315 };
316 
317 
318 /**
319  * User accounts management.
320  */
321 interface Users {
322 
323  /**
324  * Activate user(s) from a directory service.
325  *
326  * @param errors - list of error messages for appropriate users
327  * @param userIds - list of global user identifiers
328  */
329  void activate(out kerio::web::ErrorList errors, in kerio::web::KIdList userIds);
330 
331  /**
332  * Activate user(s) from a directory service in distributed domain environment.
333  *
334  * @param errors - list of error messages for appropriate users
335  * @param userIds - list of global user identifiers
336  * @param homeServerId - Id of server in distributed domain on which users will be activated
337  */
338  void activateOnServer(out kerio::web::ErrorList errors, in kerio::web::KIdList userIds, in kerio::web::KId homeServerId);
339 
340  /**
341  * Register connection.
342  *
343  * @param service - service name (should be some real service ID, returned by Services.get)
344  * @param connectionId - unique connection identifier
345  * @param port - host port
346  * @param isSecure - ssl connection
347  */
348  void connectFromExternalService(out boolean result, in string service, in string connectionId, in string clientIpAddress, in long port, in boolean isSecure);
349 
350  /**
351  * Authenticate given user and create session. connectionId must be registered by function connectFromExternalService otherwise authenticate fails.
352  *
353  * @param result - resut of autentication.
354  * @param userName - login name + domain name (can be omitted if primary) of the user to be logged in, e.g. "jdoe" or "jdoe@company.com"
355  * @param password - password of the user to be authenticate (base64-encoded)
356  * @param connectionId - connection identifier, must be the same as in connectFromExternalService
357  * @param isSecure - ssl connection
358  */
359  void authenticateConnectionFromExternalService(out AuthResult result, in string userName, in string password, in string service, in string connectionId, in boolean isSecure);
360 
361  /**
362  * Unregister connection registered by connectFromExternalService and destroy session created if authenticateFromExternalService was called.
363  * @param service - service name
364  * @param connectionId - unique connection identifier
365  */
366  void disconnectFromExternalService(in string service, in string connectionId);
367 
368  /**
369  * Cancel wiping of user's mobile device.
370  *
371  * @param userId - global user identifier
372  * @param deviceId - ID of user's mobile device to cancel wipe
373  */
374  void cancelWipeMobileDevice(in kerio::web::KId userId, in string deviceId);
375 
376  /**
377  * Check integrity of all folders in user(s) mailboxes.
378  * If corrupted folder is found, try to fix it.
379  *
380  * @param userIds - list of user identifiers
381  */
382  void checkMailboxIntegrity(in kerio::web::KIdList userIds);
383 
384  /**
385  * Create new users.
386  *
387  * @param errors - error message list
388  * @param result - list of IDs of created users
389  * @param users - new user entities
390  */
391  void create(out kerio::web::ErrorList errors, out kerio::web::CreateResultList result, in UserList users);
392 
393  /**
394  * Create new users in directory service
395  * @param errors - error message list
396  * @param result - list of IDs of created users
397  * @param users - new user entities
398  */
399  void createLdap(out kerio::web::ErrorList errors, out kerio::web::CreateResultList result, in UserList users);
400 
401  /**
402  * Export statistics of given users in given format.
403  *
404  * @param fileDownload - description of output file
405  * @param userIds - list of IDs of given users
406  * @param format - output data format
407  */
408  void exportStatistics(out kerio::web::Download fileDownload, in kerio::web::KIdList userIds, in FileFormatType format);
409 
410  /**
411  * Export given domain users to comma-separated values file format.
412  *
413  * @param fileDownload - description of output file
414  * @param filename - part of filename; full filename is compound as user_<domainname>_<filename>_<date>.csv
415  * @param query - query attributes and limits
416  * @param domainId - domain identification
417  */
418  void exportToCsv(out kerio::web::Download fileDownload, in string filename, in kerio::web::SearchQuery query, in kerio::web::KId domainId);
419 
420  /**
421  * Obtain a list of users in given domain.
422  *
423  * @param list - users
424  * @param totalItems - number of users found in given domain
425  * @param query - query attributes and limits
426  * @param domainId - domain identification
427  */
428  void get(out UserList list, out long totalItems, in kerio::web::SearchQuery query, in kerio::web::KId domainId);
429 
430  /**
431  * Obtain a list of contact public folders in given domain.
432  *
433  * @param publicFolderList - list of public folders
434  * @param domainId - global identification of domain
435  */
436  void getContactPublicFolderList(out PublicFolderList publicFolders, in kerio::web::KId domainId);
437 
438  /**
439  * Obtain list of users from given LDAP server potentially importable to the Connect server.
440  *
441  * @param newUsers - list of users
442  * @param importServer - properties of the server to import from
443  * @param domainToImport - the mailserver domain where users are imported
444  */
445  void getFromServer(out ImporteeList newUsers, in ImportServer importServer, in kerio::web::KId domainToImport);
446 
447  /**
448  * Obtain the number of users created on the server and number of active mailboxes.
449  * This method may take a long time if a directory service for mapped users is not available.
450  *
451  * @param count - Number of users created on the server and number of active mailboxes.
452  */
453  void getMailboxCount(out MailboxCount count);
454 
455  /**
456  * Obtain a list of mobile devices of given user.
457  *
458  * @param list - mobile devices of given user
459  * @param totalItems - number of mobile devices found for given user
460  * @param userId - name of user
461  * @param query - query attributes and limits
462  */
463  void getMobileDeviceList(out kerio::jsonapi::mobile::MobileDeviceList list, out long totalItems, in kerio::web::KId userId, in kerio::web::SearchQuery query);
464 
465  /**
466  * Obtain a list of LDAP mapped users who are not activated in given domain.
467  * Only user's ID, loginName, fullName, description are set in structures.
468  *
469  * @param newUsers - list of users
470  * @param domainId - global identification of domain
471  */
472  void getNotActivated(out ImporteeList newUsers, in kerio::web::KId domainId);
473 
474  /**
475  * Obtain a size of items stored for recovering.
476  *
477  * @param errors - error message list
478  * @param sizes - count and size of items
479  * @param userIds - global identification of user
480  */
481  void getRecoveryDeletedItemsSize(out kerio::web::ErrorList errors, out QuotaUsageList sizeList, in kerio::web::KIdList userIds);
482 
483  /**
484  * Obtain statistics of given users.
485  *
486  * @param list - users' statistics
487  * @param userIds - list of IDs of given users
488  * @param query - query parameters and limits
489  */
490  void getStatistics(out UserStatList list, in kerio::web::KIdList userIds, in kerio::web::SearchQuery query);
491 
492  /**
493  * Parse users from given string. It is used to import users from file. The only supported encoding is UTF-8.
494  *
495  * @param users - list of parsed users with appropriate status and message
496  * @param fileId - ID of the uploaded file
497  * @param domainToImport - import to given domain, magic constants
498  * 'PRIMARY_DOMAIN': use primary domain
499  * 'PRESERVE_FROM_CSV': preserve domain from CSV file (use primary if not defined)
500  */
501  void parseFromCsv(out ImporteeList users, in string fileId, in kerio::web::KId domainToImport);
502 
503  /**
504  * Recover deleted items for particular user(s).
505  * If the user quota is exceeded an error with code 4000 will be returned.
506  *
507  * @param recoveryMessages - list of recovery messages
508  * @param userIds - list of user IDs
509  * @param recoverAnyway - if true messages are recovered even if the user quota is exceeded.
510  */
511  void recoverDeletedItems(out kerio::web::ErrorList errors, out ResultTripletList recoveryMessages, in kerio::web::KIdList userIds);
512 
513  /**
514  * Remove user(s).
515  *
516  * @param errors - list of users failed to remove only (successfully removed are NOT listed)
517  * @param requests - list of user IDs to be removed, method, and owner of deleted messages
518  */
519  void remove(out kerio::web::ErrorList errors, in RemovalRequestList requests);
520 
521  /**
522  * Remove mobile device from the list of user's mobile devices.
523  *
524  * @param userId - name of user
525  * @param deviceId - ID of user's mobile device to be removed
526  */
527  void removeMobileDevice(in kerio::web::KId userId, in string deviceId);
528 
529  /**
530  * IM: Reset buddy list of selected users
531  *
532  * @param userIds - list of user identifiers
533  */
534  void resetBuddyList(in kerio::web::KIdList userIds);
535 
536 
537  /**
538  * Obtains user effective rights (inherited from groups)
539  *
540  * @param errors - list of users failed to get effective rights
541  * @param result - list of effective rights
542  * @param userIds - list of IDs of users
543  */
544  void getEffectiveUserRights(out kerio::web::ErrorList errors, out EffectiveUserRightsList result, in kerio::web::KIdList userIds);
545 
546 
547  /**
548  * Set users' details according given pattern.
549  *
550  * @param errors - create a new user
551  * @param userIds - list of IDs of users to be changed
552  * @param pattern - pattern to use for new values
553  */
554  void set(out kerio::web::ErrorList errors, in kerio::web::KIdList userIds, in User pattern);
555 
556  /**
557  * Wipe user's mobile device.
558  *
559  * @param userId - global user identifier
560  * @param deviceId - ID of user's mobile device to be wiped
561  */
562  void wipeMobileDevice(in kerio::web::KId userId, in string deviceId);
563 
564  /**
565  * Get personal user contacts
566  *
567  */
568  void getPersonalContact(out kerio::web::ErrorList errors, out kerio::jsonapi::contacts::PersonalContactList contacts, in kerio::web::KIdList userIds);
569 
570  /**
571  * Set personal user contacts
572  *
573  */
574  void setPersonalContact(out kerio::web::ErrorList errors, in kerio::web::KIdList userIds, in kerio::jsonapi::contacts::PersonalContact contact);
575 };
576 
577 }; }; };//end of namespace