MDMSetup.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2016-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import "ThreemaFramework.h"
  22. extern NSString * const MDM_CONFIGURATION_KEY;
  23. extern NSString * const MDM_FEEDBACK_KEY;
  24. extern NSString * const MDM_THREEMA_CONFIGURATION_KEY;
  25. extern NSString * const MDM_KEY_LICENSE_USERNAME;
  26. extern NSString * const MDM_KEY_LICENSE_PASSWORD;
  27. extern NSString * const MDM_KEY_NICKNAME;
  28. extern NSString * const MDM_KEY_LINKED_EMAIL;
  29. extern NSString * const MDM_KEY_LINKED_PHONE;
  30. extern NSString * const MDM_KEY_FIRST_NAME;
  31. extern NSString * const MDM_KEY_LAST_NAME;
  32. extern NSString * const MDM_KEY_CSI;
  33. extern NSString * const MDM_KEY_CATEGORY;
  34. extern NSString * const MDM_KEY_CONTACT_SYNC;
  35. extern NSString * const MDM_KEY_READONLY_PROFILE;
  36. extern NSString * const MDM_KEY_ID_BACKUP;
  37. extern NSString * const MDM_KEY_ID_BACKUP_PASSWORD;
  38. extern NSString * const MDM_KEY_BLOCK_UNKNOWN;
  39. extern NSString * const MDM_KEY_HIDE_INACTIVE_IDS;
  40. extern NSString * const MDM_KEY_DISABLE_SAVE_TO_GALLERY;
  41. extern NSString * const MDM_KEY_DISABLE_ADD_CONTACT;
  42. extern NSString * const MDM_KEY_DISABLE_EXPORT;
  43. extern NSString * const MDM_KEY_DISABLE_BACKUPS;
  44. extern NSString * const MDM_KEY_DISABLE_ID_EXPORT;
  45. extern NSString * const MDM_KEY_DISABLE_SYSTEM_BACKUPS;
  46. extern NSString * const MDM_KEY_DISABLE_MESSAGE_PREVIEW;
  47. extern NSString * const MDM_KEY_DISABLE_SEND_PROFILE_PICTURE;
  48. extern NSString * const MDM_KEY_DISABLE_CALLS;
  49. extern NSString * const MDM_KEY_DISABLE_VIDEO_CALLS;
  50. extern NSString * const MDM_KEY_DISABLE_CREATE_GROUP;
  51. extern NSString * const MDM_KEY_SKIP_WIZARD;
  52. extern NSString * const MDM_KEY_DISABLE_WEB;
  53. extern NSString * const MDM_KEY_WEB_HOSTS;
  54. extern NSString * const MDM_KEY_DISABLE_SHARE_MEDIA;
  55. extern NSString * const MDM_KEY_SAFE_ENABLE;
  56. extern NSString * const MDM_KEY_SAFE_PASSWORD;
  57. extern NSString * const MDM_KEY_SAFE_SERVER_URL;
  58. extern NSString * const MDM_KEY_SAFE_SERVER_USERNAME;
  59. extern NSString * const MDM_KEY_SAFE_SERVER_PASSWORD;
  60. extern NSString * const MDM_KEY_SAFE_RESTORE_ENABLE;
  61. extern NSString * const MDM_KEY_SAFE_RESTORE_ID;
  62. extern NSString * const MDM_KEY_SAFE_PASSWORD_PATTERN;
  63. extern NSString * const MDM_KEY_SAFE_PASSWORD_MESSAGE;
  64. extern NSString * const MDM_KEY_THREEMA_CONFIGURATION;
  65. extern NSString * const MDM_KEY_THREEMA_OVERRIDE;
  66. extern NSString * const MDM_KEY_THREEMA_PARAMS;
  67. typedef enum : int {
  68. CallsPolicyTypeAllowAll,
  69. CallsPolicyTypeDisableAll,
  70. CallsPolicyTypeDisableVideo,
  71. CallsPolicyTypeUnknown
  72. } CallsPolicyType;
  73. @interface MDMSetup : NSObject {
  74. BOOL isSetup;
  75. /// true means it is Threema Work
  76. BOOL isLicenseRequired;
  77. dispatch_queue_t queue;
  78. }
  79. @property (readonly, assign) NSString *idBackup;
  80. @property (readonly, assign) NSString *idBackupPassword;
  81. - (MDMSetup*) initWithSetup:(BOOL)setup;
  82. + (void)clearMdmCache;
  83. - (BOOL)disableBackups;
  84. - (BOOL)disableIdExport;
  85. - (BOOL)disableSystemBackups;
  86. - (BOOL)readonlyProfile;
  87. - (BOOL)disableAddContact;
  88. - (BOOL)disableSaveToGallery;
  89. - (BOOL)disableExport;
  90. - (BOOL)disableMessagePreview;
  91. - (BOOL)disableCalls;
  92. - (BOOL)disableVideoCalls;
  93. - (BOOL)disableWeb;
  94. - (NSString *)webHosts;
  95. - (BOOL)disableCreateGroup;
  96. - (BOOL)disableSendProfilePicture;
  97. - (BOOL)skipWizard;
  98. - (BOOL)disableShareMedia;
  99. - (BOOL)disableHideStaleContacts;
  100. - (NSNumber*)safeEnable;
  101. - (NSString*)safePassword;
  102. - (NSString*)safeServerUrl;
  103. - (NSString*)safeServerUsername;
  104. - (NSString*)safeServerPassword;
  105. - (NSString *)safePasswordPattern;
  106. - (NSString *)safePasswordMessage;
  107. - (BOOL)safeRestoreEnable;
  108. - (NSString*)safeRestoreId;
  109. - (BOOL)isSafeBackupDisable;
  110. - (BOOL)isSafeBackupForce;
  111. - (BOOL)isSafeBackupPasswordPreset;
  112. - (BOOL)isSafeBackupServerPreset;
  113. - (BOOL)isSafeRestoreDisable;
  114. - (BOOL)isSafeRestoreForce;
  115. - (BOOL)isSafeRestorePasswordPreset;
  116. - (BOOL)isSafeRestoreServerPreset;
  117. - (void)loadRenewableValues;
  118. - (void)loadLicenseInfo;
  119. - (void)loadIDCreationValues;
  120. - (BOOL)hasIDBackup;
  121. - (void)restoreIDBackupOnCompletion:(void(^)(void))onCompletion onError:(void(^)(NSError *error))onError;
  122. - (BOOL)isManaged;
  123. - (BOOL)existsMdmKey:(NSString*)mdmKey;
  124. - (void)applyThreemaMdm:(NSDictionary *)workData;
  125. - (void)deleteThreemaMdm;
  126. @end