zm-ruby-client 3.1.2 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +134 -0
  3. data/README.md +42 -0
  4. data/VERSION +1 -1
  5. data/lib/zm/client/account/account.rb +214 -8
  6. data/lib/zm/client/account/account_jsns_builder.rb +6 -18
  7. data/lib/zm/client/account/account_jsns_initializer.rb +1 -1
  8. data/lib/zm/client/account/accounts_collection.rb +1 -0
  9. data/lib/zm/client/account/accounts_response.rb +21 -0
  10. data/lib/zm/client/backup/backups_collection.rb +1 -1
  11. data/lib/zm/client/backup/backups_response.rb +16 -0
  12. data/lib/zm/client/base/account_search_objects_collection.rb +7 -0
  13. data/lib/zm/client/base/admin_objects_collection.rb +18 -8
  14. data/lib/zm/client/base/admin_objects_response.rb +23 -0
  15. data/lib/zm/client/base/base_jsns_initializer.rb +34 -3
  16. data/lib/zm/client/base/has_cos.rb +75 -0
  17. data/lib/zm/client/base/has_zimbra_attributes.rb +133 -0
  18. data/lib/zm/client/base/object.rb +2 -0
  19. data/lib/zm/client/base/objects_builder.rb +1 -1
  20. data/lib/zm/client/base/zimbra_attributes_collection.rb +43 -166
  21. data/lib/zm/client/base/zimbra_attrs_jsns.rb +44 -0
  22. data/lib/zm/client/cluster/cluster.rb +16 -9
  23. data/lib/zm/client/cluster/cluster_config.rb +50 -18
  24. data/lib/zm/client/contact/contact_jsns_initializer.rb +16 -16
  25. data/lib/zm/client/contact/contact_members_collection.rb +19 -1
  26. data/lib/zm/client/cos/cos.rb +183 -11
  27. data/lib/zm/client/cos/cos_jsns_builder.rb +4 -16
  28. data/lib/zm/client/cos/cos_jsns_initializer.rb +2 -2
  29. data/lib/zm/client/cos/coses_collection.rb +1 -0
  30. data/lib/zm/client/cos/coses_response.rb +27 -0
  31. data/lib/zm/client/deprecation.rb +24 -0
  32. data/lib/zm/client/distributionlist/distributionlist.rb +11 -4
  33. data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +4 -16
  34. data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +1 -2
  35. data/lib/zm/client/distributionlist/distributionlists_collection.rb +1 -0
  36. data/lib/zm/client/distributionlist/distributionlists_response.rb +16 -0
  37. data/lib/zm/client/distributionlist/dls_membership_collection.rb +5 -5
  38. data/lib/zm/client/domain/domain.rb +51 -10
  39. data/lib/zm/client/domain/domain_jsns_builder.rb +4 -16
  40. data/lib/zm/client/domain/domain_jsns_initializer.rb +9 -2
  41. data/lib/zm/client/domain/domains_collection.rb +1 -0
  42. data/lib/zm/client/domain/domains_response.rb +23 -0
  43. data/lib/zm/client/folder/folder.rb +1 -0
  44. data/lib/zm/client/folder/folder_default.rb +3 -1
  45. data/lib/zm/client/folder/folder_grants_collection.rb +24 -0
  46. data/lib/zm/client/folder/folder_jsns_initializer.rb +4 -3
  47. data/lib/zm/client/folder/folder_retention_policies_collection.rb +8 -0
  48. data/lib/zm/client/folder/folder_retention_policy.rb +2 -2
  49. data/lib/zm/client/folder/folder_view_filters.rb +32 -0
  50. data/lib/zm/client/folder/folders_builder.rb +31 -16
  51. data/lib/zm/client/folder/folders_collection.rb +21 -13
  52. data/lib/zm/client/folder/folders_response.rb +14 -0
  53. data/lib/zm/client/mailbox/mailbox_item_concern.rb +1 -3
  54. data/lib/zm/client/mailbox/mailbox_item_id.rb +7 -1
  55. data/lib/zm/client/mountpoint/mount_points_builder.rb +3 -3
  56. data/lib/zm/client/mountpoint/mount_points_collection.rb +0 -4
  57. data/lib/zm/client/mountpoint/mount_points_response.rb +10 -0
  58. data/lib/zm/client/resource/resource.rb +215 -4
  59. data/lib/zm/client/resource/resource_jsns_builder.rb +4 -16
  60. data/lib/zm/client/resource/resource_jsns_initializer.rb +1 -1
  61. data/lib/zm/client/resource/resources_collection.rb +1 -0
  62. data/lib/zm/client/resource/resources_response.rb +16 -0
  63. data/lib/zm/client/server/server.rb +28 -2
  64. data/lib/zm/client/server/servers_collection.rb +1 -0
  65. data/lib/zm/client/server/servers_response.rb +43 -0
  66. data/lib/zm/client/upload.rb +2 -0
  67. data/lib/zm/client/zm_logger.rb +32 -2
  68. data/lib/zm/client.rb +15 -0
  69. data/lib/zm/connector/network_error_handler.rb +2 -0
  70. data/lib/zm/connector/rest_connector.rb +2 -0
  71. data/lib/zm/connector/soap_account_connector.rb +2 -0
  72. data/lib/zm/connector/soap_base_connector.rb +11 -7
  73. data/lib/zm/connector/ssl.rb +10 -0
  74. data/lib/zm/connector.rb +2 -1
  75. data/lib/zm/soap_request/request_methods_admin.rb +10 -6
  76. data/lib/zm/soap_request/soap_context.rb +2 -2
  77. data/lib/zm/support/cache/file_store.rb +2 -11
  78. data/lib/zm/support/cache/store.rb +4 -2
  79. data/lib/zm/utils/log_filter.rb +13 -5
  80. data/lib/zm-ruby-client.rb +0 -2
  81. data/sig/zm/client/admin_objects.rbs +119 -11
  82. data/sig/zm/client/base.rbs +81 -4
  83. data/sig/zm/client/cluster.rbs +13 -6
  84. data/sig/zm/client/mailbox.rbs +91 -2
  85. metadata +18 -17
  86. data/lib/zm/modules/common/zimbra-attrs.csv +0 -737
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83346f50bc674cfe9232fa984c3e28ff1eb7b160d5aec5af1d25325ff08bfe40
4
- data.tar.gz: 566253f251f44522425ec053640fae2b72ee799749b13568ccc0435538c05f5c
3
+ metadata.gz: df474821aa498c045017c13c290a3d8fa90f69e97705f4651b2816fe9193d01e
4
+ data.tar.gz: 5b06c67ff76f37846f9ebeb8e8d52778b38979f25e5e557cab12901de21b39c5
5
5
  SHA512:
6
- metadata.gz: 26b7e61b0953ed5dc01a5aef0b9e5b14a42f695b43f8d0557f80716275b635423fd89409aa7c372789b96ea7ce28ef23e4208b1d7ef71534dd59322b606c16d4
7
- data.tar.gz: a3ad36e6f6990fc0b21959191b7a88ddb51ea501d8fca0e1fb433384f35a876e101d9829d055aeaa2e628407b48938ced18f48e894010d0bbfac3e5492245d8a
6
+ metadata.gz: 499f6998b0f5deb9be42b2f71554a2c91c2f0b00d34cd07957e8d2da583f8d90195d181b3397a54d76ac29e8392d0c51883bfb69868d5faad682348705a4294b
7
+ data.tar.gz: 9fad1ac9bf85a468834974112bb700fb16e17075d39697b1987144f013a6443ddc5c0cc8e130567bac51b3c7307aa4238917670b282d8411f27c9cb7da0689c9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,139 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased [3.2.1]
4
+
5
+ ### [3.2.1]
6
+
7
+ #### Changes
8
+
9
+ - [Fixed] first on the account search collections (messages, contacts, appointments, tasks, documents) no longer keeps a limit of 1 for the following requests of the collection
10
+
11
+ ## Released [3.2.0]
12
+
13
+ ### [3.2.0] 2026-12
14
+
15
+ #### Upgrading from 3.1
16
+
17
+ - **The Zimbra attributes are declared in the classes.** `Account`, `Resource`, `Cos`, `Domain`, `Server` and
18
+ `DistributionList` declare their attributes with `zimbra_attr` (the list of the removed
19
+ `zimbra-attrs.csv`): the accessors exist as soon as the class is loaded, without creating a `Cluster`.
20
+ - **Custom attributes:** a custom CSV file (`zimbra_attributes_path=`) is replaced by `zimbra_attr`, for example
21
+ `Zm::Client::Account.zimbra_attr :employeeNumber` (`readonly: true` for an attribute that must never be sent).
22
+ - **Deprecated, removed in 4.0:** `Cluster#zimbra_attributes` (rebuilt from the classes, the attribute `type` is
23
+ always nil), `ClusterConfig#zimbra_attributes_path` (returns nil) and `ClusterConfig#zimbra_attributes_path=`
24
+ (ignored) print a warning on first use. `Base::ZimbraAttributesCollection` and `Base::ZimbraAttribute` go with them.
25
+ Use `Zm::Client::Account.zimbra_attrs`, `zimbra_attrs_readonly` and `attrs_write` instead.
26
+ - **The `csv` gem is no longer a dependency.**
27
+ - **`ClusterConfig#zimbra_version` is deprecated, removed in 4.0.** It was not used by the gem. The accessor and the
28
+ `zimbra_version` parameter print a warning on first use. `Cluster#version` no longer starts with this value (`8.8.15`
29
+ by default): it is `nil` until `Cluster#infos!` reads the server version.
30
+ - **`modify!` sends only the changed attributes.** On `Account`, `Resource`, `Cos`, `Domain` and `DistributionList`,
31
+ `modify!` (and `save!` on a recorded object) sends only the writable attributes assigned through their setter since
32
+ the object was loaded, created or modified, instead of every attribute set on the object. Without change it sends no
33
+ request and returns `false`. A value changed in place (`account.zimbraMailForwardingAddress << 'x@domain.tld'`) is
34
+ not seen: assign a new value or call `zimbra_attr_will_change!(:zimbraMailForwardingAddress)`. Setting an attribute
35
+ to `nil` or `[]` now clears it on the server. An attribute set with `instance_variable_set` is no longer sent by
36
+ `modify!` (it still is by `create!`). `modify!(force: true)` keeps the 3.1 behavior and sends every writable
37
+ attribute set on the object.
38
+ - **`update!` sends only the values different from the object.** A Zimbra attribute whose value equals the one of the
39
+ object (`'1024'` equals `1024`, `'a'` equals `['a']`) is not sent, unless it has a change pending through its
40
+ setter. Without difference `update!` sends no request and returns `false`. `update!(..., force: true)` sends every
41
+ given value as in 3.1.
42
+ - **`account.folders.ids` returns `MailboxItemID` objects instead of id strings.** Each one gives the folder id
43
+ (`item_id`) and, for a folder of another mailbox, its mailbox id (`mailbox_id`). Use
44
+ `account.folders.ids.map(&:item_id)` to get the 3.1 strings back (a remote folder id loses its `<mailbox id>:`
45
+ prefix, read it from `mailbox_id`).
46
+ - **`account.folders` forgets its query params after each request.** `view`, `tr`, `visible`, `needGranteeName` and
47
+ `depth` (set by `where`, `message`, `contact`...) apply to the next request only: `account.folders.message.all`
48
+ followed by `account.folders.all` now returns every folder, not only the mail folders. Set the params again before
49
+ each request.
50
+ - **`FoldersBuilder#flatten` takes keyword arguments.** `flatten(folder, collector)` becomes
51
+ `flatten(folder: folder, collector: collector)`. Without `folder:` it builds the tree from the response (`make`)
52
+ instead of reusing the root of a previous `make`.
53
+ - **`MountPointsCollection#root` is removed.** It was never set and always returned `nil`. Use
54
+ `account.folders.tree` for the root folder.
55
+ - **`Account#cos` returns `nil` when `zimbraCOSId` is not set** instead of searching a COS without id. The account
56
+ then uses the default COS of its domain (`zimbraDomainDefaultCOSId`): use `account.effective_cos` for the COS
57
+ applied by Zimbra.
58
+
59
+ #### Changes
60
+
61
+ - [Changed] Declare the Zimbra attributes of Account, Resource, Cos, Domain, Server and DistributionList in the classes with zimbra_attr
62
+ - [Added] Add Base::HasZimbraAttributes: zimbra_attr, zimbra_attrs, zimbra_attrs_writable, zimbra_attrs_readonly, attrs_write and attrs_write_ivars class methods, Server#attrs_write
63
+ - [Changed] Cluster.new no longer parses the attributes CSV file nor defines accessors
64
+ - [Changed] Jsns builders reuse the memoized attrs_write_ivars instead of mapping attrs_write on every request
65
+ - [Removed] Remove zimbra-attrs.csv and the csv dependency
66
+ - [Deprecated] Cluster#zimbra_attributes, ClusterConfig#zimbra_attributes_path and zimbra_attributes_path=, Base::ZimbraAttributesCollection and Base::ZimbraAttribute, removed in 4.0
67
+ - [Removed] Remove the zimbra attributes integration tests (covered by unit tests)
68
+ - [Changed] modify! of Account, Resource, Cos, Domain and DistributionList sends only the changed writable attributes, sends no request without change and clears the attributes set to nil or empty
69
+ - [Added] modify!(force: true) sends every writable attribute set on the object, changed or not
70
+ - [Fixed] Server#update! raised NoMethodError (do_update! was missing), it sends a ModifyServerRequest
71
+ - [Changed] update! of Account, Resource, Cos, Domain, DistributionList and Server sends only the Zimbra attributes whose value differs from the object, update!(force: true) sends them all
72
+ - [Added] Changes tracking of the writable Zimbra attributes: zimbra_attrs_changed, zimbra_attrs_changed?, zimbra_attr_changed?, zimbra_attr_will_change! and clear_zimbra_attrs_changes, Base::HasZimbraAttributes.zimbra_attrs_ivars
73
+ - [Deprecated] ClusterConfig#zimbra_version, zimbra_version= and the zimbra_version parameter, not used, removed in 4.0
74
+ - [Changed] Cluster#version is nil until Cluster#infos! instead of ClusterConfig#zimbra_version
75
+ - [Changed] Jsns initializers set the Zimbra attributes directly instead of calling their setter
76
+ - [Changed] Account, Resource, Cos, Domain and DistributionList jsns builders share Base::ZimbraAttrsJsns
77
+ - [Fixed] FoldersBuilder computes absFolderPath from the parent folder when GetFolderResponse has none (old Zimbra versions)
78
+ - [Fixed] FolderJsnsInitializer keeps the :folder type when the response has no type instead of setting it to nil
79
+ - [Fixed] AccountSearchObjectsCollection#ids (messages.ids...) always returned [], ObjectsBuilder#ids read a :Body key already removed by invoke
80
+ - [Fixed] ContactJsnsInitializer keeps the custom contact attributes as instance variables (sent back by save!) instead of losing them, no more NoMethodError raised and rescued for every contact
81
+ - [Fixed] AdminObjectsCollection#find_each keeps the query params (ldap, order, attrs...) for its pages instead of resetting them with count
82
+ - [Fixed] SoapBaseConnector#target_invoke no longer changes the shared SoapContext, the target server is set in the request only (concurrent requests of other threads could be sent to the target server)
83
+ - [Changed] BaseJsnsInitializer reads the attributes of the response in one pass without building an intermediate Hash (about 25% faster, half the allocations)
84
+ - [Changed] Cluster#domain_key memoizes the domain keys read from the server (one GetDomainRequest per domain instead of one per preauth login)
85
+ - [Added] Cluster#clear_domain_keys
86
+ - [Changed] LogFilter.filter masks the secrets in one pass with a single regexp instead of four (about 2 times faster, half the memory on large debug logs)
87
+ - [Changed] FileStore#normalize_key splits the key with scan (about 4 times faster, 22 allocations per key instead of 329), the cache paths are unchanged
88
+ - [Changed] faraday and openssl are no longer required with the gem but with the first connector, require 'zm-ruby-client' takes about 12 ms and 1 MB instead of 90 ms and 13 MB
89
+ - [Added] Zm::Connector::SSL_VERIFY_PEER
90
+ - [Changed] Cache keys are hashed with Digest::SHA256 instead of OpenSSL::Digest::SHA256 (same keys)
91
+ - [Fixed] ClusterConfig reads log_path from the Hash or the config file, it was ignored and the logs went to $stdout
92
+ - [Added] ClusterConfig reads log_level (Integer, or a name such as 'debug' or :warn) and colorize_logging (true only) from the Hash or the config file
93
+ - [Changed] ClusterConfig#log_level= accepts a level name ('debug', :warn) and raises ArgumentError for an invalid level
94
+ - [Fixed] ClusterConfig.new and init_from_h no longer empty the given Hash (a frozen Hash raised FrozenError)
95
+ - [Fixed] ClusterConfig#log_path= redirects the logger already created (and used by the connectors and the cache) instead of being ignored, nil or File::NULL disable the logs, only a file opened by the logger is closed
96
+ - [Added] ZmLogger#log_path=
97
+ - [Fixed] ClusterConfig#colorize_logging= turns the colors on or off on the logger already created instead of being ignored
98
+ - [Changed] ZmLogger#colorize! sets a flag instead of extending the logger with ZmLogger::ZmLoggerColorized (still available), the colors can be turned off
99
+ - [Added] ZmLogger#colorize=, ZmLogger#colorize?, ZmLogger::ZmLoggerColors
100
+ - [Added] FoldersCollection#all returns a FoldersResponse (an Array) with messages, appointments, contacts, tasks, documents, immutables and by_view
101
+ - [Added] FoldersCollection#tree returns the root folder with its children (Folder#folders)
102
+ - [Changed] FoldersCollection#ids returns MailboxItemID objects instead of id strings
103
+ - [Changed] FoldersCollection resets its query params (view, tr, visible, needGranteeName, depth) after each request, they no longer apply to the following requests
104
+ - [Added] MailboxItemID.create parses a remote id ("257" or "<mailbox id>:257")
105
+ - [Changed] FoldersBuilder#flatten takes keyword arguments (folder:, collector:), folder defaults to the tree built by make
106
+ - [Added] MountPointsCollection#all returns a MountPointsResponse (an Array) with messages, appointments, contacts, tasks, documents and by_view
107
+ - [Added] FolderViewFilters, the filters by view shared by FoldersResponse and MountPointsResponse
108
+ - [Removed] MountPointsCollection#root, never set (always nil)
109
+ - [Added] AdminObjectsCollection#find_in_batches yields each page of the search (an Array of limit objects at most), find_each is built on it
110
+ - [Fixed] AdminObjectsCollection#find_each resets the query params and the ldap filter when the block raises, the collection kept them for the next request
111
+ - [Changed] AdminObjectsCollection#find_each stops at the first empty page and returns nil
112
+ - [Added] AdminObjectsCollection#all and find_in_batches return a Base::AdminObjectsResponse (an Array) with update_all! and delete_all!
113
+ - [Added] AccountsCollection#all and find_in_batches return an AccountsResponse: by_server groups the accounts by zimbraMailHost (an AccountsResponse per server), statuses counts them by zimbraAccountStatus
114
+ - [Added] ResourcesCollection#all and find_in_batches return a ResourcesResponse: locations and equipments select the resources by zimbraCalResType (a ResourcesResponse each)
115
+ - [Added] DistributionListsCollection#all and find_in_batches return a DistributionListsResponse: groups (zimbraMailStatus disabled) and mailing_lists (enabled) select the lists (a DistributionListsResponse each)
116
+ - [Added] ServersCollection#all returns a ServersResponse: with_service, mailbox_servers, mta_servers, proxy_servers and ldap_servers select the servers by zimbraServiceEnabled, by_service groups them by enabled service
117
+ - [Added] DomainsCollection#all and find_in_batches return a DomainsResponse: locals and aliases select the domains by zimbraDomainType, statuses counts them by zimbraDomainStatus
118
+ - [Added] Domain::LOCAL and Domain::ALIAS
119
+ - [Added] CosesCollection#all and find_in_batches return a CosesResponse: with_server and by_server select or group the classes of service by zimbraMailHostPool, unlimited_quotas selects those with a zimbraMailQuota of 0
120
+ - [Added] BackupsCollection#all returns a BackupsResponse (an Array) with fulls and incrementals
121
+ - [Added] FolderGrantsCollection#accounts, distribution_lists, domains, publics, externals and keys select the grants by grantee type
122
+ - [Added] FolderRetentionPoliciesCollection#keeps and purges select the retention policies by policy
123
+ - [Fixed] FolderJsnsInitializer loads the retention policies of GetFolderResponse, they were always ignored (the retentionPolicy element is a Hash, not an Array)
124
+ - [Fixed] FolderRetentionPolicy#keep? and purge? accept a policy given as a String ('keep', 'purge')
125
+ - [Added] ContactMembersCollection#internals, shared, frees and ldaps select the members of a contact group by type
126
+ - [Changed] ContactMembersCollection delegates to all through MissingMethodStaticCollection (each, map, select...) like the other static collections
127
+ - [Added] sig: ContactMember and ContactMembersCollection
128
+ - [Added] Account#cos= and Domain#cos= set the COS and its id (zimbraCOSId, zimbraDomainDefaultCOSId), nil clears it, raise ArgumentError for an object that is not a recorded Cos
129
+ - [Changed] Account#cos returns nil when zimbraCOSId is not set
130
+ - [Fixed] Account#cos and Domain#cos read the COS again when its id changed, they returned the memoized COS of the previous id
131
+ - [Added] Base::HasCos: has_cos defines cos and cos= from the attribute holding the COS id, used by Account, Resource and Domain
132
+ - [Added] Resource#cos and Resource#cos=
133
+ - [Added] Account#reset_to_cos!(cos: effective_cos) and Resource#reset_to_cos! clear (ModifyAccountRequest, ModifyCalendarResourceRequest) the attributes of the account or resource with the same value as the COS, so that they inherit it again, and return their names. They compare the attributes loaded on the object: load it with ldap (applyCos=0)
134
+ - [Added] Account#effective_cos and Resource#effective_cos return the COS applied by Zimbra: their own COS, else the default COS of their domain, else the "default" COS
135
+ - [Fixed] DistributionList#memberships always returned an empty list (it read a :Body key already removed by invoke) and sent an account element instead of dl in GetDistributionListMembershipRequest
136
+
3
137
  ## Released [3.1.1]
4
138
 
5
139
  ### [3.1.1] 2026-11
data/README.md CHANGED
@@ -73,6 +73,17 @@ cluster.accounts
73
73
  cluster.accounts.where('(zimbraLastLogonTimestamp<=20250101000000Z)').update_all!(zimbraAccountStatus: 'locked')
74
74
  ```
75
75
 
76
+ **Or work page by page on a large directory.**
77
+
78
+ ```ruby
79
+ cluster.accounts
80
+ .where('(zimbraLastLogonTimestamp<=20250101000000Z)')
81
+ .find_in_batches(limit: 500) { |accounts| accounts.update_all!(zimbraAccountStatus: 'locked') }
82
+ ```
83
+
84
+ > Each page is read at the next offset: do not delete the objects of a page inside the block, the next page would skip
85
+ > as many objects.
86
+
76
87
  **Step into any mailbox, no user password needed.**
77
88
 
78
89
  ```ruby
@@ -101,6 +112,30 @@ account.folders.find(2).download('inbox.tgz') # Inbox backup
101
112
  account.folders.find(7).export_contacts # Contacts, as CSV
102
113
  ```
103
114
 
115
+ **Bring your own LDAP attributes.**
116
+
117
+ ```ruby
118
+ Zm::Client::Account.zimbra_attr :employeeNumber
119
+ account.update!(employeeNumber: '42')
120
+ ```
121
+
122
+ **Send only what changed.**
123
+
124
+ ```ruby
125
+ account = cluster.accounts.find_by(name: 'john@domain.tld')
126
+ account.displayName = 'John Doe'
127
+ account.save! # ModifyAccountRequest with displayName only
128
+
129
+ account.zimbraMailForwardingAddress << 'jane@domain.tld'
130
+ account.zimbra_attr_will_change!(:zimbraMailForwardingAddress) # in-place change: flag it
131
+ account.save!
132
+
133
+ account.modify!(force: true) # every attribute set on the object, changed or not
134
+
135
+ account.update!(displayName: 'John Doe', description: 'Sales') # description only: displayName is unchanged
136
+ account.update!(displayName: 'John Doe', force: true) # sent anyway
137
+ ```
138
+
104
139
  **Ask quick questions.**
105
140
 
106
141
  ```ruby
@@ -117,6 +152,13 @@ from the installed gem, for use with [Steep](https://github.com/soutaro/steep) o
117
152
  bundle exec rbs collection install
118
153
  ```
119
154
 
155
+ ## Upgrading from 3.1
156
+
157
+ 3.2 no longer reads the Zimbra attributes from a CSV file: they are declared in each class (`zimbra_attr`) and
158
+ available without a `Cluster`. `Cluster#zimbra_attributes` and `ClusterConfig#zimbra_attributes_path=` are deprecated
159
+ and will be removed in 4.0. `modify!` (and `save!` on a recorded object) of an admin object now sends only the
160
+ attributes changed through their setter. See the [upgrade notes](CHANGELOG.md#upgrading-from-31).
161
+
120
162
  ## Upgrading from 3.0
121
163
 
122
164
  3.1 requires Ruby 3.3, moves the error classes to `Zm::Error` (`rescue Zm::Error::SoapError`) and raises
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.2.1
@@ -5,16 +5,225 @@ module Zm
5
5
  # objectClass: zimbraAccount
6
6
  class Account < Base::MailboxObject
7
7
  include SoapRequest::RequestMethodsAdmin
8
+ extend Base::HasZimbraAttributes
9
+
10
+ zimbra_attr %i[
11
+ c co company cn description destinationIndicator displayName facsimileTelephoneNumber gn givenName homePhone
12
+ initials internationaliSDNNumber l mobile o ou pager physicalDeliveryOfficeName postOfficeBox postalAddress
13
+ postalCode preferredDeliveryMethod registeredAddress sn st street streetAddress telephoneNumber
14
+ teletexTerminalIdentifier telexNumber title userCertificate userPassword userSMIMECertificate x121Address
15
+ zimbraAccountStatus zimbraMailHost zimbraNotes zimbraMailForwardingAddress zimbraCOSId zimbraMailStatus
16
+ zimbraMailQuota zimbraPrefMailSignature zimbraPrefMailSignatureEnabled zimbraPrefSaveToSent zimbraIsAdminAccount
17
+ zimbraMailSieveScript zimbraPasswordMinLength zimbraPasswordMaxLength zimbraPasswordMinAge zimbraPasswordMaxAge
18
+ zimbraPasswordEnforceHistory zimbraPasswordHistory zimbraPasswordModifiedTime zimbraPasswordMustChange
19
+ zimbraPasswordLocked zimbraPrefGroupMailBy zimbraPrefIncludeSpamInSearch zimbraPrefIncludeTrashInSearch
20
+ zimbraPrefMailItemsPerPage zimbraPrefOutOfOfficeReply zimbraPrefOutOfOfficeReplyEnabled zimbraPrefReplyToAddress
21
+ zimbraPrefUseKeyboardShortcuts zimbraPrefMailInitialSearch zimbraPrefSentMailFolder zimbraMailTrashLifetime
22
+ zimbraMailSpamLifetime zimbraMailMessageLifetime zimbraContactMaxNumEntries zimbraAuthTokenLifetime
23
+ zimbraAdminAuthTokenLifetime zimbraMailMinPollingInterval zimbraPrefMailPollingInterval zimbraAttachmentsBlocked
24
+ zimbraAttachmentsViewInHtmlOnly zimbraPrefNewMailNotificationEnabled zimbraPrefNewMailNotificationAddress
25
+ zimbraPrefForwardReplyPrefixChar zimbraPrefAutoAddAddressEnabled zimbraPrefReplyIncludeOriginalText
26
+ zimbraPrefForwardIncludeOriginalText zimbraFeatureContactsEnabled zimbraFeatureCalendarEnabled
27
+ zimbraFeatureTaggingEnabled zimbraFeatureSavedSearchesEnabled zimbraFeatureConversationsEnabled
28
+ zimbraFeatureChangePasswordEnabled zimbraFeatureInitialSearchPreferenceEnabled zimbraFeatureFiltersEnabled
29
+ zimbraPrefDedupeMessagesSentToSelf zimbraPrefMessageViewHtmlPreferred zimbraMailIdleSessionTimeout
30
+ zimbraPrefContactsPerPage zimbraFeatureGalEnabled zimbraNewMailNotificationFrom zimbraNewMailNotificationSubject
31
+ zimbraNewMailNotificationBody zimbraPrefMailSignatureStyle zimbraAttachmentsIndexingEnabled zimbraImapEnabled
32
+ zimbraPop3Enabled zimbraPrefShowFragments zimbraPrefComposeInNewWindow zimbraMailCanonicalAddress
33
+ zimbraMailCatchAllAddress zimbraMailCatchAllForwardingAddress zimbraMailCatchAllCanonicalAddress
34
+ zimbraPrefComposeFormat zimbraPrefForwardReplyInOriginalFormat zimbraFeatureHtmlComposeEnabled
35
+ zimbraPrefShowSearchString zimbraPrefTimeZoneId zimbraPrefUseTimeZoneListInCalendar
36
+ zimbraPrefCalendarInitialView zimbraPrefImapSearchFoldersEnabled zimbraMailTransport zimbraAuthLdapExternalDn
37
+ zimbraPrefHtmlEditorDefaultFontFamily zimbraPrefHtmlEditorDefaultFontSize zimbraPrefHtmlEditorDefaultFontColor
38
+ zimbraPrefCalendarFirstDayOfWeek zimbraPrefCalendarNotifyDelegatedChanges zimbraPrefCalendarUseQuickAdd
39
+ zimbraPrefCalendarInitialCheckedCalendars zimbraPrefCalendarAlwaysShowMiniCal zimbraZimletAvailableZimlets
40
+ zimbraProxyAllowedDomains zimbraForeignPrincipal zimbraZimletUserProperties zimbraIsDomainAdminAccount
41
+ zimbraFeatureViewInHtmlEnabled zimbraAccountCalendarUserType zimbraFeatureSharingEnabled
42
+ zimbraPrefCalendarApptReminderWarningTime zimbraFeatureMailForwardingEnabled zimbraPrefMailForwardingAddress
43
+ zimbraPrefMailLocalDeliveryDisabled zimbraLocale zimbraMailboxLocationBeforeMove zimbraFeatureMobileSyncEnabled
44
+ zimbraHideInGal zimbraFeatureSkinChangeEnabled zimbraPrefSkin zimbraFeatureGalAutoCompleteEnabled
45
+ zimbraAvailableSkin zimbraDebugInfo zimbraFeatureOutOfOfficeReplyEnabled zimbraFeatureNewMailNotificationEnabled
46
+ zimbraPrefGalAutoCompleteEnabled zimbraIsSystemResource zimbraPasswordLockoutEnabled
47
+ zimbraPasswordLockoutDuration zimbraPasswordLockoutMaxFailures zimbraPasswordLockoutFailureLifetime
48
+ zimbraPasswordLockoutLockedTime zimbraPasswordLockoutFailureTime zimbraPrefOutOfOfficeFromDate
49
+ zimbraPrefOutOfOfficeUntilDate zimbraPrefOutOfOfficeCacheDuration zimbraPrefOutOfOfficeDirectAddress
50
+ zimbraPasswordMinUpperCaseChars zimbraPasswordMinLowerCaseChars zimbraPasswordMinPunctuationChars
51
+ zimbraPasswordMinNumericChars zimbraTextAnalyzer zimbraPrefUseRfc2231 zimbraPrefShortcuts
52
+ zimbraDomainAdminMaxMailQuota zimbraVersion zimbraPrefFromDisplay zimbraPrefFromAddress zimbraPrefReplyToDisplay
53
+ zimbraPrefReplyToEnabled zimbraPrefWhenSentToEnabled zimbraPrefWhenSentToAddresses
54
+ zimbraPrefWhenInFoldersEnabled zimbraPrefWhenInFolderIds zimbraPrefBccAddress zimbraPrefIdentityName
55
+ zimbraPrefForwardReplyFormat zimbraIdentityMaxNumEntries zimbraFeatureIdentitiesEnabled
56
+ zimbraFeaturePop3DataSourceEnabled zimbraDataSourceMaxNumEntries zimbraAllowAnyFromAddress
57
+ zimbraAllowFromAddress zimbraArchiveAccount zimbraArchiveAccountNameTemplate zimbraArchiveAccountDateTemplate
58
+ zimbraFeatureTasksEnabled zimbraSyncWindowSize zimbraPrefCalendarDayHourStart zimbraPrefCalendarDayHourEnd
59
+ zimbraPrefLocale zimbraFeatureVoiceEnabled zimbraAdminSavedSearches zimbraFeaturePortalEnabled zimbraPortalName
60
+ zimbraFeatureOptionsEnabled zimbraPrefClientType zimbraMailSignatureMaxLength zimbraDataSourcePollingInterval
61
+ zimbraPrefWarnOnExit zimbraPrefMailDefaultCharset zimbraPrefDeleteInviteOnReply zimbraPrefShowSelectionCheckbox
62
+ zimbraFeatureGroupCalendarEnabled zimbraNotebookMaxRevisions zimbraQuotaWarnPercent zimbraQuotaLastWarnTime
63
+ zimbraQuotaWarnInterval zimbraQuotaWarnMessage zimbraAvailableLocale zimbraFeatureMailEnabled zimbraSignatureId
64
+ zimbraSignatureName zimbraPrefDefaultSignatureId zimbraSignatureMaxNumEntries zimbraFeatureSignaturesEnabled
65
+ zimbraFeatureBriefcasesEnabled zimbraFeatureFlaggingEnabled zimbraPrefOpenMailInNewWindow
66
+ zimbraExcludeFromCMBSearch zimbraPrefDisplayExternalImages zimbraPrefMailSignatureHTML
67
+ zimbraFeatureInstantNotify zimbraSignatureMinNumEntries zimbraDataSourceMinPollingInterval
68
+ zimbraPrefVoiceItemsPerPage zimbraFeatureMailUpsellEnabled zimbraFeatureMailUpsellURL
69
+ zimbraFeatureContactsUpsellEnabled zimbraFeatureContactsUpsellURL zimbraFeatureCalendarUpsellEnabled
70
+ zimbraFeatureCalendarUpsellURL zimbraFeatureVoiceUpsellEnabled zimbraFeatureVoiceUpsellURL
71
+ zimbraPrefInboxUnreadLifetime zimbraPrefInboxReadLifetime zimbraPrefSentLifetime zimbraPrefJunkLifetime
72
+ zimbraPrefTrashLifetime zimbraFeatureZimbraAssistantEnabled zimbraPrefAutoSaveDraftInterval
73
+ zimbraFeatureMailPriorityEnabled zimbraFeatureImapDataSourceEnabled zimbraPrefCalendarReminderEmail
74
+ zimbraJunkMessagesIndexingEnabled zimbraFeatureComposeInNewWindowEnabled zimbraFeatureOpenMailInNewWindowEnabled
75
+ zimbraIsCustomerCareAccount zimbraPrefLabel zimbraSpamApplyUserFilters zimbraCustomerCareTier
76
+ zimbraFreebusyExchangeURL zimbraFreebusyExchangeAuthUsername zimbraFreebusyExchangeAuthPassword
77
+ zimbraFreebusyExchangeUserOrg zimbraFreebusyExchangeAuthScheme zimbraInterceptAddress
78
+ zimbraInterceptSendHeadersOnly zimbraInterceptFrom zimbraInterceptSubject zimbraInterceptBody
79
+ zimbraBatchedIndexingSize zimbraFreebusyExchangeCachedIntervalStart zimbraFreebusyExchangeCachedInterval
80
+ zimbraFeatureNewAddrBookEnabled zimbraPrefTagTreeOpen zimbraPrefSearchTreeOpen zimbraPrefGalSearchEnabled
81
+ zimbraPrefFolderTreeOpen zimbraPrefZimletTreeOpen zimbraNotebookSanitizeHtml zimbraPrefMarkMsgRead
82
+ zimbraPrefPop3DownloadSince zimbraYahooId zimbraACE zimbraPrefMailSoundsEnabled
83
+ zimbraPrefCalendarReminderSoundsEnabled zimbraPrefAdvancedClientEnforceMinDisplay zimbraPrefMailFlashTitle
84
+ zimbraPrefMailFlashIcon zimbraPrefCalendarReminderFlashTitle zimbraPrefCalendarAllowForwardedInvite
85
+ zimbraPrefCalendarAllowPublishMethodInvite zimbraPrefStandardClientAccessibilityMode zimbraPrefListViewColumns
86
+ zimbraPrefCalendarAllowCancelEmailToSelf zimbraFeatureMailForwardingInFiltersEnabled zimbraCalendarMaxRevisions
87
+ zimbraFeatureGalSyncEnabled zimbraMailPurgeUseChangeDateForTrash zimbraPrefMandatorySpellCheckEnabled
88
+ zimbraFreebusyLocalMailboxNotActive zimbraContactRankingTableSize zimbraPrefSharedAddrBookAutoCompleteEnabled
89
+ zimbraAdminConsoleUIComponents zimbraPrefZimlets zimbraDataSourcePop3PollingInterval
90
+ zimbraDataSourceImapPollingInterval zimbraDataSourceLivePollingInterval zimbraDataSourceRssPollingInterval
91
+ zimbraPrefFolderColorEnabled zimbraFeatureDiscardInFiltersEnabled zimbraReverseProxyUseExternalRoute
92
+ zimbraExternalPop3Port zimbraExternalPop3SSLPort zimbraExternalImapPort zimbraExternalImapSSLPort
93
+ zimbraExternalPop3Hostname zimbraExternalPop3SSLHostname zimbraExternalImapHostname
94
+ zimbraExternalImapSSLHostname zimbraDataSourceCaldavPollingInterval zimbraDataSourceYabPollingInterval
95
+ zimbraSmtpEnableTrace zimbraMailWhitelistMaxNumEntries zimbraMailBlacklistMaxNumEntries
96
+ zimbraPrefReadingPaneLocation zimbraFeatureConfirmationPageEnabled zimbraPrefMailToasterEnabled
97
+ zimbraPrefCalendarToasterEnabled zimbraPrefIMToasterEnabled zimbraCalendarCalDavSyncStart
98
+ zimbraCalendarCalDavSyncEnd zimbraCalendarCalDavSharedFolderCacheDuration zimbraPrefConversationOrder
99
+ zimbraDataSourceCalendarPollingInterval zimbraFeatureReadReceiptsEnabled zimbraPrefMailSendReadReceipts
100
+ zimbraDataSourceGalPollingInterval zimbraContactAutoCompleteMaxResults zimbraPrefCalendarApptVisibility
101
+ zimbraFeatureMobilePolicyEnabled zimbraMobilePolicyAllowNonProvisionableDevices
102
+ zimbraMobilePolicyAllowPartialProvisioning zimbraMobilePolicyRefreshInterval
103
+ zimbraMobilePolicyDevicePasswordEnabled zimbraMobilePolicyMinDevicePasswordLength
104
+ zimbraMobilePolicyAllowSimpleDevicePassword zimbraMobilePolicyAlphanumericDevicePasswordRequired
105
+ zimbraMobilePolicyMinDevicePasswordComplexCharacters zimbraMobilePolicyDevicePasswordExpiration
106
+ zimbraMobilePolicyDevicePasswordHistory zimbraMobilePolicyMaxInactivityTimeDeviceLock
107
+ zimbraMobilePolicyMaxDevicePasswordFailedAttempts zimbraMobilePolicyPasswordRecoveryEnabled
108
+ zimbraPrefCalendarAutoAddInvites zimbraPrefCalendarSendInviteDeniedAutoReply zimbraPrefCalendarForwardInvitesTo
109
+ zimbraIsDelegatedAdminAccount zimbraPrefConvReadingPaneLocation zimbraMaxMailItemsPerPage
110
+ zimbraMaxContactsPerPage zimbraMaxVoiceItemsPerPage zimbraPrefCalendarShowPastDueReminders
111
+ zimbraGalSyncAccountBasedAutoCompleteEnabled zimbraPrefAppleIcalDelegationEnabled
112
+ zimbraPrefAdminConsoleWarnOnExit zimbraMailForwardingAddressMaxLength zimbraMailForwardingAddressMaxNumAddrs
113
+ zimbraPrefSpellDictionary zimbraAuthTokenValidityValue zimbraPrefShowCalendarWeek
114
+ zimbraPrefMailSelectAfterDelete zimbraWebClientShowOfflineLink zimbraPrefAccountTreeOpen
115
+ zimbraFeatureVoiceChangePinEnabled zimbraFeatureManageZimlets zimbraFeatureBriefcaseSpreadsheetEnabled
116
+ zimbraFeatureBriefcaseSlidesEnabled zimbraFeatureBriefcaseDocsEnabled zimbraPrefGetMailAction
117
+ zimbraPrefMailFoldersCheckedForNewMsgIndicator zimbraPrefSpellIgnoreWord zimbraPrefDisabledZimlets
118
+ zimbraSmtpRestrictEnvelopeFrom zimbraPrefItemsPerVirtualPage zimbraCalendarResourceDoubleBookingAllowed
119
+ zimbraContactEmailFields zimbraPrefCalendarApptAllowAtendeeEdit zimbraPrefAutoCompleteQuickCompletionOnComma
120
+ zimbraCalendarShowResourceTabs zimbraPrefDefaultPrintFontSize zimbraMailAllowReceiveButNotSendWhenOverQuota
121
+ zimbraPrefCalendarWorkingHours zimbraMailPurgeUseChangeDateForSpam zimbraPrefForwardReplySignatureId
122
+ zimbraFeatureMAPIConnectorEnabled zimbraDumpsterEnabled zimbraPrefMailSignatureContactId
123
+ zimbraMailOutgoingSieveScript zimbraMailDumpsterLifetime zimbraFeatureDistributionListExpandMembersEnabled
124
+ zimbraFeatureMailSendLaterEnabled zimbraPrefMailTrustedSenderList zimbraMailTrustedSenderListMaxNumEntries
125
+ zimbraCalendarReminderDeviceEmail zimbraFeatureFreeBusyViewEnabled zimbraPhoneticFirstName
126
+ zimbraPhoneticLastName zimbraPhoneticCompany zimbraFeatureCalendarReminderDeviceEmailEnabled
127
+ zimbraPrefTasksReadingPaneLocation zimbraPrefBriefcaseReadingPaneLocation zimbraFilterBatchSize
128
+ zimbraFilterSleepInterval zimbraMailThreadingAlgorithm zimbraPasswordMinAlphaChars zimbraPasswordAllowedChars
129
+ zimbraFeatureContactsDetailedSearchEnabled zimbraPrefPop3DeleteOption zimbraPrefPop3IncludeSpam
130
+ zimbraFeatureAntispamEnabled zimbraFeatureAdminMailEnabled zimbraPrefShortEmailAddress
131
+ zimbraFeatureManageSMIMECertificateEnabled zimbraFeatureImportFolderEnabled zimbraFeatureExportFolderEnabled
132
+ zimbraFeatureSMIMEEnabled zimbraPrefCalendarDefaultApptDuration zimbraPrefSortOrder
133
+ zimbraPrefCalendarAutoAcceptSignatureId zimbraPrefCalendarAutoDeclineSignatureId
134
+ zimbraPrefCalendarAutoDenySignatureId zimbraPrefCalendarViewTimeInterval zimbraPrefCalendarShowDeclinedMeetings
135
+ zimbraPrefFileSharingApplication zimbraPrefMessageIdDedupingEnabled zimbraPrefCalendarAcceptSignatureId
136
+ zimbraPrefCalendarTentativeSignatureId zimbraPrefCalendarDeclineSignatureId
137
+ zimbraMobileSmartForwardRFC822Enabled zimbraArchiveEnabled zimbraPrefSpellIgnoreAllCaps zimbraDefaultFolderFlags
138
+ zimbraPrefQuickCommand zimbraMailHighlightObjectsMaxSize zimbraIsSystemAccount zimbraPrefMailRequestReadReceipts
139
+ zimbraCalendarLocationDisabledFields zimbraSharedItem zimbraCalendarKeepExceptionsOnSeriesTimeChange
140
+ zimbraIsExternalVirtualAccount zimbraExternalUserMailAddress zimbraPrefOutOfOfficeStatusAlertOnLogin
141
+ zimbraPrefFont zimbraPasswordMinDigitsOrPuncs zimbraPasswordAllowedPunctuationChars zimbraExternalShareLifetime
142
+ zimbraExternalSharingEnabled zimbraExternalShareWhitelistDomain zimbraExternalShareDomainWhitelistEnabled
143
+ zimbraStandardClientCustomPrefTabsEnabled zimbraStandardClientCustomPrefTab zimbraFeaturePriorityInboxEnabled
144
+ zimbraFeatureSocialFiltersEnabled zimbraPrefComposeDirection zimbraPrefShowComposeDirection
145
+ zimbraMobilePolicyAllowStorageCard zimbraMobilePolicyAllowCamera zimbraMobilePolicyRequireDeviceEncryption
146
+ zimbraMobilePolicyAllowUnsignedApplications zimbraMobilePolicyAllowUnsignedInstallationPackages
147
+ zimbraMobilePolicyAllowWiFi zimbraMobilePolicyAllowTextMessaging zimbraMobilePolicyAllowPOPIMAPEmail
148
+ zimbraMobilePolicyAllowBluetooth zimbraMobilePolicyAllowIrDA zimbraMobilePolicyRequireManualSyncWhenRoaming
149
+ zimbraMobilePolicyAllowDesktopSync zimbraMobilePolicyMaxCalendarAgeFilter zimbraMobilePolicyAllowHTMLEmail
150
+ zimbraMobilePolicyMaxEmailAgeFilter zimbraMobilePolicyMaxEmailBodyTruncationSize
151
+ zimbraMobilePolicyMaxEmailHTMLBodyTruncationSize zimbraMobilePolicyRequireSignedSMIMEMessages
152
+ zimbraMobilePolicyRequireEncryptedSMIMEMessages zimbraMobilePolicyRequireSignedSMIMEAlgorithm
153
+ zimbraMobilePolicyRequireEncryptionSMIMEAlgorithm zimbraMobilePolicyAllowSMIMEEncryptionAlgorithmNegotiation
154
+ zimbraMobilePolicyAllowSMIMESoftCerts zimbraMobilePolicyAllowBrowser zimbraMobilePolicyAllowConsumerEmail
155
+ zimbraMobilePolicyAllowRemoteDesktop zimbraMobilePolicyAllowInternetSharing
156
+ zimbraMobilePolicyUnapprovedInROMApplication zimbraMobilePolicyApprovedApplication
157
+ zimbraMobilePolicySuppressDeviceEncryption zimbraPrefCalendarReminderDeviceInfo
158
+ zimbraFileExpirationWarningThreshold zimbraFileLifetime zimbraFileExpirationWarningSubject
159
+ zimbraFileExpirationWarningBody zimbraFileDeletionNotificationSubject zimbraFileDeletionNotificationBody
160
+ zimbraDumpsterUserVisibleAge zimbraDumpsterPurgeEnabled zimbraPrefOutOfOfficeExternalReply
161
+ zimbraPrefOutOfOfficeExternalReplyEnabled zimbraInternalSendersDomain zimbraPrefExternalSendersType
162
+ zimbraPrefTasksFilterBy zimbraFileVersioningEnabled zimbraFileVersionLifetime
163
+ zimbraPrefAllowAddressForDelegatedSender zimbraPrefOutOfOfficeFreeBusyStatus
164
+ zimbraPrefIncludeSharedItemsInSearch zimbraShareLifetime zimbraFileUploadMaxSizePerFile
165
+ zimbraPublicSharingEnabled zimbraPublicShareLifetime zimbraFileShareLifetime zimbraFileExternalShareLifetime
166
+ zimbraFilePublicShareLifetime zimbraExternalAccountDisabledTime zimbraExternalAccountLifetimeAfterDisabled
167
+ zimbraFeatureExternalFeedbackEnabled zimbraFeatureCrocodocEnabled zimbraFileAndroidCrashReportingEnabled
168
+ zimbraFeatureSocialcastEnabled zimbraSocialcastURL zimbraFileIOSCrashReportingEnabled
169
+ zimbraZimletLoadSynchronously zimbraPrefConvShowCalendar zimbraDevicePasscodeEnabled
170
+ zimbraDeviceAllowedPasscodeLockoutDuration zimbraDevicePasscodeLockoutDuration zimbraDeviceLockWhenInactive
171
+ zimbraDeviceFileOpenWithEnabled zimbraUCServiceId zimbraUCUsername zimbraUCPassword
172
+ zimbraMobilePolicyApprovedApplicationList zimbraDeviceOfflineCacheEnabled zimbraVirtualAccountInitialPasswordSet
173
+ zimbraDataSourceImportOnLogin zimbraPrefFromAddressType zimbraMobileNotificationEnabled
174
+ zimbraMobileNotificationAdminAddress zimbraMobileAttachSkippedItemEnabled zimbraPrefColorMessagesEnabled
175
+ zimbraMobileMetadataMaxSizeEnabled zimbraMobileItemsToTrackPerFolderMaxSize zimbraPrefSpellIgnorePattern
176
+ zimbraTouchJSErrorTrackingEnabled zimbraTouchJSErrorTrackingKey zimbraForceClearCookies
177
+ zimbraFeatureDistributionListFolderEnabled zimbraMobileSyncKeyFormatConvertedFolders zimbraConverterHints
178
+ zimbraFilePreviewMaxSize zimbraMobilePolicyRequireStorageCardEncryption zimbraPrefFontSize
179
+ zimbraDeviceCalendarSoftDeleteExcludePattern zimbraWebClientOfflineSyncMaxDays zimbraMobileOutlookSyncEnabled
180
+ zimbraFeatureFromDisplayEnabled zimbraFeatureSocialEnabled zimbraFeatureSocialExternalEnabled
181
+ zimbraFeatureSocialExternalURL zimbraMobileShareContactEnabled zimbraPrefWebClientOfflineBrowserKey
182
+ zimbraMobileForceSamsungProtocol25 zimbraMobileForceProtocol25 zimbraFeatureEwsEnabled
183
+ zimbraPrefOutOfOfficeSuppressExternalReply zimbraAuthTokens zimbraFeatureWebClientOfflineAccessEnabled
184
+ zimbraFeatureSocialName zimbraPrefCalendarAllowedTargetsForInviteDeniedAutoReply zimbraMobileTombstoneEnabled
185
+ zimbraLogOutFromAllServers zimbraFeatureTouchClientEnabled zimbraCommunityAPIClientID
186
+ zimbraCommunityAPIClientSecret zimbraCommunityUsernameMapping zimbraCommunityBaseURL zimbraCommunityHomeURL
187
+ zimbraMobileSyncRedoMaxAttempts zimbraCommunityID zimbraPrefUseSendMsgShortcut zimbraPrefDelegatedSendSaveTarget
188
+ zimbraFeatureAdminPreferencesEnabled zimbraIsMobileGatewayAppAccount zimbraPrefShowChatsFolderInMail
189
+ zimbraTwoFactorAuthEnabled zimbraFeatureTwoFactorAuthRequired zimbraTwoFactorAuthNumScratchCodes
190
+ zimbraMaxAppSpecificPasswords zimbraRevokeAppSpecificPasswordsOnPasswordChange zimbraAppSpecificPasswordDuration
191
+ zimbraPrefShowAllNewMailNotifications zimbraFeatureAppSpecificPasswordsEnabled
192
+ zimbraTwoFactorAuthTrustedDeviceTokenLifetime zimbraPrefZmgPushNotificationEnabled zimbraPrefTabInEditorEnabled
193
+ zimbraFeatureDataSourcePurgingEnabled zimbraDataSourceQuota zimbraDataSourceTotalQuota
194
+ zimbraNewMailNotificationMessage zimbraTwoFactorAuthTokenLifetime zimbraTwoFactorAuthEnablementTokenLifetime
195
+ zimbraZimletUserPropertiesMaxNumEntries zimbraIsMobileGatewayProxyAccount
196
+ zimbraDisableCrossAccountConversationThreading zimbraOAuthAccessor zimbraFeatureTwoFactorAuthAvailable
197
+ zimbraPrefChatPlaySound zimbraFeatureChatEnabled zimbraFeatureTrustedDevicesEnabled
198
+ zimbraMobileSearchMimeSupportEnabled zimbraExportMaxDays zimbraPrefChatEnabled
199
+ zimbraTwoFactorAuthLockoutMaxFailures zimbraTwoFactorAuthLockoutFailureTime zimbraFeatureMobileGatewayEnabled
200
+ zimbraAvailabilityServiceProvider zimbraPasswordLockoutSuppressionCacheSize
201
+ zimbraPasswordLockoutSuppressionEnabled zimbraPasswordLockoutSuppressionProtocols zimbraChatHistoryEnabled
202
+ zimbraSieveRejectMailEnabled zimbraSieveNotifyActionRFCCompliant zimbraAdminSieveScriptBefore
203
+ zimbraAdminSieveScriptAfter zimbraAdminOutgoingSieveScriptBefore zimbraAdminOutgoingSieveScriptAfter
204
+ zimbraSieveRequireControlEnabled zimbraSieveEditHeaderEnabled zimbraSieveImmutableHeaders
205
+ zimbraFeatureMarkMailForwardedAsRead zimbraFeatureAddressVerificationEnabled
206
+ zimbraFeatureAddressVerificationExpiry zimbraFeatureAddressUnderVerification
207
+ zimbraFeatureAddressVerificationStatus zimbraFeatureContactBackupEnabled zimbraPrefOutOfOfficeSpecificDomains
208
+ thumbnailPhoto zimbraPrefDisplayTimeInMailList zimbraFeatureAdvancedSearchEnabled
209
+ zimbraFeatureResetPasswordStatus zimbraFeatureResetPasswordSuspensionTime zimbraPasswordRecoveryMaxAttempts
210
+ zimbraPrefDefaultCalendarId zimbraRecoveryAccountCodeValidity zimbraResetPasswordRecoveryCodeExpiry
211
+ zimbraShowClientTOS
212
+ ]
213
+
214
+ zimbra_attr %i[
215
+ mail uid zimbraId zimbraMailAddress zimbraMemberOf zimbraMailDeliveryAddress zimbraMailAlias
216
+ zimbraLastLogonTimestamp zimbraCreateTimestamp zimbraTwoFactorAuthSecret zimbraTwoFactorAuthScratchCodes
217
+ zimbraAppSpecificPassword zimbraTwoFactorAuthTrustedDevices
218
+ ], readonly: true
8
219
 
9
220
  # #################################################################
10
221
  # Associations
11
222
  # #################################################################
12
223
 
13
- def cos
14
- return @cos if defined? @cos
224
+ extend Base::HasCos
15
225
 
16
- @cos = @parent.coses.find_by(id: zimbraCOSId)
17
- end
226
+ has_cos :zimbraCOSId, effective: true
18
227
 
19
228
  # #################################################################
20
229
  # SOAP Actions
@@ -22,6 +231,7 @@ module Zm
22
231
 
23
232
  def create!
24
233
  resp = sac.invoke(build_create)
234
+ clear_zimbra_attrs_changes
25
235
  @id = resp[:CreateAccountResponse][:account].first[:id]
26
236
  end
27
237
 
@@ -48,10 +258,6 @@ module Zm
48
258
  soap_request
49
259
  end
50
260
 
51
- def attrs_write
52
- @parent.zimbra_attributes.all_account_attrs_writable_names
53
- end
54
-
55
261
  has_jsns_builder
56
262
 
57
263
  def batch
@@ -4,6 +4,8 @@ module Zm
4
4
  module Client
5
5
  # class for account jsns builder
6
6
  class AccountJsnsBuilder
7
+ include Base::ZimbraAttrsJsns
8
+
7
9
  def initialize(item)
8
10
  @item = item
9
11
  end
@@ -23,8 +25,8 @@ module Zm
23
25
  soap_request
24
26
  end
25
27
 
26
- def add_soap_request_nodes(soap_request)
27
- attrs_only_set_h.each do |key, values|
28
+ def add_soap_request_nodes(soap_request, attrs = attrs_only_set_h)
29
+ attrs.each do |key, values|
28
30
  values.each do |value|
29
31
  add_soap_request_node(soap_request, key, value)
30
32
  end
@@ -38,11 +40,11 @@ module Zm
38
40
  soap_request.add_node(node_attr)
39
41
  end
40
42
 
41
- def to_update
43
+ def to_update(force: false)
42
44
  soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
43
45
  .add_attribute(SoapRequest::SoapConstants::ID, @item.id)
44
46
 
45
- add_soap_request_nodes(soap_request)
47
+ add_soap_request_nodes(soap_request, attrs_to_update_h(force))
46
48
 
47
49
  soap_request
48
50
  end
@@ -70,20 +72,6 @@ module Zm
70
72
  SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::RENAME_ACCOUNT_REQUEST)
71
73
  .add_attributes({ id: @item.id, newName: new_name })
72
74
  end
73
-
74
- def attrs_only_set_h
75
- selected_attrs = @item.attrs_write.map { |a| Utils.arrow_name_sym(a) }
76
- attrs_only_set = @item.instance_variables & selected_attrs
77
-
78
- arr = attrs_only_set.map do |name|
79
- n = name.to_s[1..]
80
- values = @item.instance_variable_get(name)
81
- values = [values] unless values.is_a?(Array)
82
- [n, values]
83
- end
84
-
85
- arr.to_h
86
- end
87
75
  end
88
76
  end
89
77
  end
@@ -9,7 +9,7 @@ module Zm
9
9
 
10
10
  def update(item, json)
11
11
  item.used = json.delete(:used) unless json[:used].nil?
12
- item.zimbraMailQuota = json.delete(:limit) unless json[:limit].nil?
12
+ item.instance_variable_set(:@zimbraMailQuota, json.delete(:limit)) unless json[:limit].nil?
13
13
 
14
14
  super
15
15
  end
@@ -7,6 +7,7 @@ module Zm
7
7
  def initialize(parent)
8
8
  @child_class = Account
9
9
  @builder_class = AccountsBuilder
10
+ @response_class = AccountsResponse
10
11
  @search_type = :accounts
11
12
  super
12
13
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zm
4
+ module Client
5
+ # accounts returned by AccountsCollection#all and find_in_batches
6
+ class AccountsResponse < Base::AdminObjectsResponse
7
+ def by_server
8
+ each_with_object({}) do |account, servers|
9
+ (servers[account.zimbraMailHost] ||= self.class.new(@collection)) << account
10
+ end
11
+ end
12
+
13
+ def statuses
14
+ each_with_object({}) do |account, counts|
15
+ status = account.zimbraAccountStatus
16
+ counts[status] = counts.fetch(status, 0) + 1
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -18,7 +18,7 @@ module Zm
18
18
  end
19
19
 
20
20
  def build_response
21
- BackupsBuilder.new(@parent, make_query).make
21
+ BackupsResponse.new(BackupsBuilder.new(@parent, make_query).make)
22
22
  end
23
23
  end
24
24
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zm
4
+ module Client
5
+ # backups returned by BackupsCollection#all
6
+ class BackupsResponse < Array
7
+ def fulls
8
+ self.class.new(select(&:full?))
9
+ end
10
+
11
+ def incrementals
12
+ self.class.new(select(&:incremental?))
13
+ end
14
+ end
15
+ end
16
+ end
@@ -13,6 +13,13 @@ module Zm
13
13
  reset_query_params
14
14
  end
15
15
 
16
+ def first
17
+ previous_limit = @limit
18
+ super
19
+ ensure
20
+ @limit = previous_limit
21
+ end
22
+
16
23
  def find(id)
17
24
  rep = @parent.soap_connector.invoke(build_find(id))
18
25
  entry = rep[:GetMsgResponse][:m].first