zm-ruby-client 3.0.1 → 3.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -0
- data/README.md +128 -27
- data/VERSION +1 -1
- data/lib/zm/client/account/account.rb +12 -19
- data/lib/zm/client/account/account_aliases_collection.rb +6 -4
- data/lib/zm/client/account/account_dls_membership_collection.rb +4 -3
- data/lib/zm/client/account/account_dls_owner_collection.rb +3 -2
- data/lib/zm/client/account/account_jsns_builder.rb +10 -10
- data/lib/zm/client/account/accounts_collection.rb +27 -16
- data/lib/zm/client/ace/ace.rb +3 -6
- data/lib/zm/client/ace/ace_jsns_builder.rb +6 -6
- data/lib/zm/client/appointment/appointment.rb +32 -14
- data/lib/zm/client/appointment/appointment_jsns_builder.rb +5 -5
- data/lib/zm/client/appointment/appointment_jsns_initializer.rb +6 -1
- data/lib/zm/client/appointment/appointments_collection.rb +12 -9
- data/lib/zm/client/backup/backup.rb +5 -2
- data/lib/zm/client/backup/backups_collection.rb +3 -2
- data/lib/zm/client/base/account_objects_collection.rb +1 -0
- data/lib/zm/client/base/account_search_objects_collection.rb +6 -6
- data/lib/zm/client/base/admin_objects_collection.rb +60 -7
- data/lib/zm/client/base/base_account_jsns_builder.rb +89 -87
- data/lib/zm/client/base/base_jsns_builder.rb +3 -3
- data/lib/zm/client/base/base_jsns_initializer.rb +20 -15
- data/lib/zm/client/base/mailbox_infos_collection.rb +92 -90
- data/lib/zm/client/base/mailbox_object.rb +49 -160
- data/lib/zm/client/base/mailbox_prefs_collection.rb +54 -52
- data/lib/zm/client/base/object.rb +19 -2
- data/lib/zm/client/base/objects_collection.rb +10 -10
- data/lib/zm/client/base/zimbra_attribute.rb +28 -42
- data/lib/zm/client/base/zimbra_attributes_collection.rb +38 -24
- data/lib/zm/client/{cluster/batch_request.rb → batch_request.rb} +1 -1
- data/lib/zm/client/cluster/cluster.rb +24 -61
- data/lib/zm/client/cluster/cluster_config.rb +35 -15
- data/lib/zm/client/contact/contact.rb +15 -13
- data/lib/zm/client/contact/contact_jsns_builder.rb +9 -6
- data/lib/zm/client/contact/contact_jsns_initializer.rb +2 -2
- data/lib/zm/client/contact/contact_member.rb +3 -3
- data/lib/zm/client/contact/contact_members_collection.rb +3 -3
- data/lib/zm/client/contact/contacts_builder.rb +1 -1
- data/lib/zm/client/contact/contacts_collection.rb +2 -2
- data/lib/zm/client/contact/group_contact_jsns_builder.rb +18 -14
- data/lib/zm/client/contact/mod_group_contact.rb +12 -8
- data/lib/zm/client/cos/cos.rb +15 -31
- data/lib/zm/client/cos/cos_jsns_builder.rb +21 -21
- data/lib/zm/client/cos/coses_collection.rb +11 -6
- data/lib/zm/client/datasource/datasource.rb +3 -9
- data/lib/zm/client/datasource/datasource_jsns_builder.rb +4 -4
- data/lib/zm/client/datasource/datasources_builder.rb +1 -1
- data/lib/zm/client/datasource/datasources_collection.rb +2 -2
- data/lib/zm/client/deprecated_constants.rb +36 -0
- data/lib/zm/client/distributionlist/distributionlist.rb +15 -47
- data/lib/zm/client/distributionlist/distributionlist_aces_collection.rb +4 -4
- data/lib/zm/client/distributionlist/distributionlist_aliases_collection.rb +7 -5
- data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +29 -41
- data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +14 -3
- data/lib/zm/client/distributionlist/distributionlist_members_collection.rb +14 -10
- data/lib/zm/client/distributionlist/distributionlist_owners_collection.rb +13 -13
- data/lib/zm/client/distributionlist/distributionlists_collection.rb +15 -7
- data/lib/zm/client/distributionlist/dls_membership_collection.rb +8 -6
- data/lib/zm/client/document/document.rb +5 -11
- data/lib/zm/client/document/document_jsns_builder.rb +2 -2
- data/lib/zm/client/document/documents_collection.rb +4 -4
- data/lib/zm/client/domain/domain.rb +8 -25
- data/lib/zm/client/domain/domain_jsns_builder.rb +13 -13
- data/lib/zm/client/domain/domains_collection.rb +13 -6
- data/lib/zm/client/filter_rules/filter_rules_collection.rb +1 -1
- data/lib/zm/client/filter_rules/outgoing_filter_rules_collection.rb +1 -1
- data/lib/zm/client/folder/folder.rb +34 -21
- data/lib/zm/client/folder/folder_default.rb +39 -0
- data/lib/zm/client/folder/folder_grant_jsns_builder.rb +3 -3
- data/lib/zm/client/folder/folder_grants_collection.rb +1 -1
- data/lib/zm/client/folder/folder_jsns_builder.rb +12 -12
- data/lib/zm/client/folder/folder_jsns_initializer.rb +1 -1
- data/lib/zm/client/folder/folder_retention_policies_collection.rb +6 -2
- data/lib/zm/client/folder/folder_view.rb +15 -0
- data/lib/zm/client/folder/folders_jsns_builder.rb +1 -1
- data/lib/zm/client/folder/mod_document_folder.rb +16 -12
- data/lib/zm/client/identity/identities_collection.rb +1 -1
- data/lib/zm/client/identity/identity.rb +3 -9
- data/lib/zm/client/identity/identity_jsns_builder.rb +8 -8
- data/lib/zm/client/{base/ldap_filter.rb → ldap_filter.rb} +1 -1
- data/lib/zm/client/license/licenses_collection.rb +1 -1
- data/lib/zm/client/mailbox/mailbox_item_concern.rb +0 -2
- data/lib/zm/client/message/message.rb +14 -19
- data/lib/zm/client/message/message_attachments_collection.rb +39 -0
- data/lib/zm/client/message/message_flags_collection.rb +130 -0
- data/lib/zm/client/message/message_jsns_builder.rb +4 -8
- data/lib/zm/client/message/message_jsns_initializer.rb +4 -4
- data/lib/zm/client/message/message_recipients.rb +19 -43
- data/lib/zm/client/message/messages_collection.rb +20 -4
- data/lib/zm/client/mountpoint/{mountpoint.rb → mount_point.rb} +4 -10
- data/lib/zm/client/mountpoint/{mountpoint_jsns_builder.rb → mount_point_jsns_builder.rb} +3 -3
- data/lib/zm/client/mountpoint/{mountpoint_jsns_initializer.rb → mount_point_jsns_initializer.rb} +1 -1
- data/lib/zm/client/mountpoint/{mountpoints_builder.rb → mount_points_builder.rb} +1 -1
- data/lib/zm/client/mta_queue/mta_queue.rb +4 -16
- data/lib/zm/client/mta_queue/mta_queue_action.rb +12 -0
- data/lib/zm/client/mta_queue/mta_queue_jsns_builder.rb +7 -7
- data/lib/zm/client/mta_queue/mta_queue_name.rb +14 -0
- data/lib/zm/client/mta_queue/mta_queues_collection.rb +4 -3
- data/lib/zm/client/mta_queue_item/mta_queue_items_collection.rb +1 -0
- data/lib/zm/client/recipient.rb +21 -0
- data/lib/zm/client/{common/recipients.rb → recipients.rb} +0 -16
- data/lib/zm/client/resource/resource.rb +3 -7
- data/lib/zm/client/resource/resource_jsns_builder.rb +13 -13
- data/lib/zm/client/resource/resources_collection.rb +20 -7
- data/lib/zm/client/search_folder/search_folder.rb +4 -11
- data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +6 -6
- data/lib/zm/client/search_folder/search_folders_collection.rb +1 -1
- data/lib/zm/client/server/server.rb +16 -22
- data/lib/zm/client/server/server_services.rb +26 -0
- data/lib/zm/client/server/servers_collection.rb +6 -6
- data/lib/zm/client/share/share.rb +2 -5
- data/lib/zm/client/share/shares_builder.rb +1 -1
- data/lib/zm/client/share/shares_collection.rb +5 -4
- data/lib/zm/client/signature/signature.rb +7 -13
- data/lib/zm/client/signature/signature_jsns_builder.rb +13 -13
- data/lib/zm/client/signature/signature_jsns_initializer.rb +2 -2
- data/lib/zm/client/signature/signatures_collection.rb +1 -1
- data/lib/zm/client/tag/account_object_tags_collection.rb +45 -47
- data/lib/zm/client/tag/tag.rb +3 -9
- data/lib/zm/client/tag/tag_jsns_builder.rb +3 -3
- data/lib/zm/client/tag/tags_builder.rb +1 -1
- data/lib/zm/client/tag/tags_collection.rb +2 -2
- data/lib/zm/client/task/task.rb +2 -2
- data/lib/zm/client/task/tasks_collection.rb +2 -2
- data/lib/zm/client/token.rb +4 -1
- data/lib/zm/client/upload.rb +179 -1
- data/lib/zm/client/{common/utils.rb → utils.rb} +6 -3
- data/lib/zm/client/zm_logger.rb +1 -1
- data/lib/zm/client.rb +227 -10
- data/lib/zm/connector/network_error_handler.rb +18 -0
- data/lib/zm/{client/connector → connector}/rest_connector.rb +46 -40
- data/lib/zm/{client/connector/soap_account.rb → connector/soap_account_connector.rb} +15 -17
- data/lib/zm/{client/connector/soap_admin.rb → connector/soap_admin_connector.rb} +3 -5
- data/lib/zm/connector/soap_base_connector.rb +115 -0
- data/lib/zm/connector.rb +13 -0
- data/lib/zm/error/auth_error.rb +8 -0
- data/lib/zm/error/connection_error.rb +8 -0
- data/lib/zm/error/rest_error.rb +8 -0
- data/lib/zm/{client/connector → error}/soap_error.rb +1 -10
- data/lib/zm/error/zm_error.rb +8 -0
- data/lib/zm/error.rb +11 -0
- data/lib/zm/relationship/has_many.rb +22 -0
- data/lib/zm/relationship/jsns_builder.rb +21 -0
- data/lib/zm/relationship/relationship.rb +113 -0
- data/lib/zm/relationship/schema.rb +32 -0
- data/lib/zm/relationship.rb +5 -0
- data/lib/zm/{client/soap_request → soap_request}/request_methods_admin.rb +11 -5
- data/lib/zm/{client/soap_request → soap_request}/request_methods_mailbox.rb +1 -1
- data/lib/zm/{client/soap_request/account_soap_constants.rb → soap_request/soap_account_constants.rb} +1 -1
- data/lib/zm/{client/soap_request/admin_soap_constants.rb → soap_request/soap_admin_constants.rb} +1 -1
- data/lib/zm/{client/soap_request → soap_request}/soap_constants.rb +1 -1
- data/lib/zm/{client/soap_request → soap_request}/soap_context.rb +13 -5
- data/lib/zm/{client/soap_request → soap_request}/soap_element.rb +1 -1
- data/lib/zm/{client/soap_request/mail_soap_constants.rb → soap_request/soap_mail_constants.rb} +1 -1
- data/lib/zm/soap_request.rb +14 -0
- data/lib/zm/support/cache/entry.rb +3 -3
- data/lib/zm/support/cache/file_store.rb +4 -6
- data/lib/zm/support/cache/null_store.rb +2 -4
- data/lib/zm/support/cache/store.rb +17 -9
- data/lib/zm/support/cache.rb +13 -8
- data/lib/zm/support.rb +7 -0
- data/lib/zm/{modules → utils}/belongs_to_folder.rb +1 -1
- data/lib/zm/{modules → utils}/belongs_to_tag.rb +2 -2
- data/lib/zm/utils/content_part.rb +9 -0
- data/lib/zm/utils/content_type.rb +11 -0
- data/lib/zm/{modules → utils}/has_soap_admin_connector.rb +1 -1
- data/lib/zm/utils/inspector.rb +26 -0
- data/lib/zm/utils/log_filter.rb +30 -0
- data/lib/zm/utils/missing_method_static_collection.rb +17 -0
- data/lib/zm/utils/regex.rb +11 -0
- data/lib/zm/utils/search_utils.rb +13 -0
- data/lib/zm/utils.rb +16 -0
- data/lib/zm-ruby-client.rb +12 -0
- data/sig/zm/client/admin_objects.rbs +261 -0
- data/sig/zm/client/base.rbs +191 -0
- data/sig/zm/client/cluster.rbs +152 -0
- data/sig/zm/client/mailbox.rbs +766 -0
- data/sig/zm/error.rbs +23 -0
- metadata +99 -91
- data/.gitignore +0 -59
- data/.rubocop.yml +0 -6
- data/.ruby-version +0 -1
- data/Gemfile +0 -11
- data/SECURITY.md +0 -21
- data/bin/console +0 -11
- data/lib/zm/client/account.rb +0 -9
- data/lib/zm/client/ace.rb +0 -7
- data/lib/zm/client/appointment.rb +0 -7
- data/lib/zm/client/backup.rb +0 -6
- data/lib/zm/client/base.rb +0 -21
- data/lib/zm/client/cluster.rb +0 -4
- data/lib/zm/client/common/message.rb +0 -10
- data/lib/zm/client/common.rb +0 -5
- data/lib/zm/client/connector/soap_base.rb +0 -104
- data/lib/zm/client/constant.rb +0 -229
- data/lib/zm/client/contact.rb +0 -11
- data/lib/zm/client/cos.rb +0 -10
- data/lib/zm/client/datasource.rb +0 -7
- data/lib/zm/client/distributionlist.rb +0 -8
- data/lib/zm/client/document.rb +0 -7
- data/lib/zm/client/domain.rb +0 -10
- data/lib/zm/client/filter_rule.rb +0 -7
- data/lib/zm/client/folder.rb +0 -14
- data/lib/zm/client/identity.rb +0 -7
- data/lib/zm/client/license.rb +0 -5
- data/lib/zm/client/message/attachments_collection.rb +0 -55
- data/lib/zm/client/message/message_flags.rb +0 -115
- data/lib/zm/client/message.rb +0 -10
- data/lib/zm/client/mountpoint.rb +0 -7
- data/lib/zm/client/mta_queue.rb +0 -7
- data/lib/zm/client/mta_queue_item.rb +0 -6
- data/lib/zm/client/resource.rb +0 -7
- data/lib/zm/client/search_folder.rb +0 -7
- data/lib/zm/client/server.rb +0 -7
- data/lib/zm/client/share.rb +0 -7
- data/lib/zm/client/signature.rb +0 -7
- data/lib/zm/client/soap_request.rb +0 -11
- data/lib/zm/client/tag.rb +0 -8
- data/lib/zm/client/task.rb +0 -6
- data/lib/zm/client/upload/upload.rb +0 -160
- data/lib/zm/modules/base.rb +0 -9
- data/lib/zm/modules/common/zimbra-attrs.json +0 -58
- data/lib/zm/modules/inspector.rb +0 -24
- data/lib/zm/modules/missing_method_static_collection.rb +0 -13
- data/lib/zm/modules/zm_model.rb +0 -43
- data/zm-ruby-client.gemspec +0 -27
- /data/lib/zm/client/mountpoint/{mountpoints_collection.rb → mount_points_collection.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5accd01f014ba998f54c30e0a2daa825442a12efe17463e398613516b3798f6c
|
|
4
|
+
data.tar.gz: 2f3b468efbf5bba59b9493c2c3e9e16820e306b6af92bab8f89a9ba623b21eda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d17ab24f8f5ef9b0180e1115bcdbe7949aeb0ab139b893597b7ba4f72e0ac611dc67363161b646ff0ead7a726245fadb83c701091b6ac34797aaea74b26db270
|
|
7
|
+
data.tar.gz: 3bcfdb6d64434deca30bf35587ad6b83b95aa424b6fd7a9d6bc4fa4c85fef44361107e039e00794b28da1aab05b9b89958ea43bb06304299059963b6cdae0121
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Released [3.1.0]
|
|
4
|
+
|
|
5
|
+
### [3.1.0] 2026-07
|
|
6
|
+
|
|
7
|
+
#### Upgrading from 3.0
|
|
8
|
+
|
|
9
|
+
- **Ruby 3.3 or newer is required.**
|
|
10
|
+
- **Only `require 'zm-ruby-client'` is supported.** Files were moved and are now autoloaded: requiring internal
|
|
11
|
+
files (`zm/client/...`) no longer works.
|
|
12
|
+
- **Error classes moved from `Zm::Client` to `Zm::Error`.** The 3.0 names still work in 3.1 but print a deprecation
|
|
13
|
+
warning on first use and will be removed in 4.0. Update your `rescue` clauses:
|
|
14
|
+
|
|
15
|
+
| 3.0 (deprecated) | 3.1 |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `Zm::Client::ZmError` | `Zm::Error::ZmError` |
|
|
18
|
+
| `Zm::Client::SoapError` | `Zm::Error::SoapError` |
|
|
19
|
+
| `Zm::Client::AuthError` | `Zm::Error::AuthError` |
|
|
20
|
+
| `Zm::Client::RestError` | `Zm::Error::RestError` |
|
|
21
|
+
|
|
22
|
+
- **Network failures raise `Zm::Error::ConnectionError`** (a `Zm::Error::ZmError`) instead of Faraday errors
|
|
23
|
+
(`Faraday::ConnectionFailed`, `Faraday::TimeoutError`, `Faraday::SSLError`). The Faraday error is kept as `cause`.
|
|
24
|
+
- **Low-level classes moved out of `Zm::Client`.** The 3.0 names are deprecated the same way:
|
|
25
|
+
|
|
26
|
+
| 3.0 (deprecated) | 3.1 |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `Zm::Client::SoapAdminConnector`, `SoapAccountConnector`, `SoapBaseConnector`, `RestConnector` | `Zm::Connector::*` |
|
|
29
|
+
| `Zm::Client::SoapElement`, `SoapConstants`, `SoapAdminConstants`, `SoapAccountConstants`, `SoapMailConstants` | `Zm::SoapRequest::*` |
|
|
30
|
+
| `Zm::Client::SoapUtils` | `Zm::Utils::SearchUtils` |
|
|
31
|
+
| `Zm::Client::Regex`, `ContentType`, `ContentPart` | `Zm::Utils::*` |
|
|
32
|
+
|
|
33
|
+
- **Renamed without alias:** the top-level `GroupContact` and `DocumentFolder` modules are now
|
|
34
|
+
`Zm::Client::ModGroupContact` and `Zm::Client::ModDocumentFolder`.
|
|
35
|
+
- **Removed constants:** `Zm::Client::ShareType`, `FolderType`, `SearchType`, `BackupTypes`, `CountTypes`, `COMMA` and
|
|
36
|
+
`DOUBLEPOINT`. Use the plain values instead, for example `cluster.count_object(:account)` or
|
|
37
|
+
`cluster.count_object('account')`.
|
|
38
|
+
- **`ZimbraAttribute` keeps only `name`, `type`, `immutable?` and `objects_scope`** (plus the `is_*_scoped?`
|
|
39
|
+
predicates): `optionalIn`, `requiredIn`, `flags`, `cardinality`, `callback`, `value`, `max`, `min` and `since` were
|
|
40
|
+
removed, as well as `ZimbraAttributesCollection#all_versioned`. The attributes catalog is read from the CSV file only
|
|
41
|
+
(`zimbra-attrs.json` was removed from the gem).
|
|
42
|
+
- **Cache:** only read requests (`Get*`, `Search*`, `Count*`) are cached and entries are stored with msgpack. Entries
|
|
43
|
+
written by 3.0 are ignored: you can delete the old `file_store` directory.
|
|
44
|
+
- **Stricter arguments:** `Utils.format_email` raises `ArgumentError` on a nil, non-String or blank email, and
|
|
45
|
+
distribution list members `add!`/`remove!` raise `ArgumentError` on nil instead of returning false.
|
|
46
|
+
- **`clone` no longer shares collections with the original:** a cloned distribution list starts with empty `members`
|
|
47
|
+
and `owners` (aliases are rebuilt from `zimbraMailAlias`).
|
|
48
|
+
- **`Contact#l` is a String** (`'7'` for a new contact), like the other mailbox items.
|
|
49
|
+
- TLS certificates are still not verified by default: set `ssl_verify` to enable it.
|
|
50
|
+
|
|
51
|
+
#### Changes
|
|
52
|
+
|
|
53
|
+
- [Added] Deprecated aliases for the 3.0 names moved out of Zm::Client (error classes, connectors, SoapElement, SOAP constants, SoapUtils, Regex, ContentType, ContentPart): they print a warning on first use and will be removed in 4.0
|
|
54
|
+
- [Fixed] Cluster#count_object accepts a String again ('account', as in 3.0) as well as a Symbol
|
|
55
|
+
- [Added] Add live CRUD tests (accounts, account folders, appointments, contacts, identities, messages, signatures and tags, resources, distribution lists, domains, coses) against a real server in test/live, rake test:live task configured by ZIMBRA_ADMIN_URL, ZIMBRA_ADMIN_LOGIN and ZIMBRA_ADMIN_PASSWORD
|
|
56
|
+
- [Fixed] ContactJsnsBuilder no longer sends internal instance variables (updated, token, tags, folder, shared account ids) as contact attributes
|
|
57
|
+
- [Fixed] GroupContactJsnsBuilder: to_create and to_patch raised NameError, the folder is read from l, members are sent without op on creation
|
|
58
|
+
- [Fixed] MessageFlagsCollection: read!, unread!, flag! and unflag! raised NoMethodError (soap_connector called on the message instead of its account)
|
|
59
|
+
- [Changed] MessageFlagsCollection: read!, unread!, flag! and unflag! update the message flags (f) after the request
|
|
60
|
+
- [Fixed] Contact: the default folder (l) is set through l= and is a String like the other mailbox items
|
|
61
|
+
- [Fixed] Base::Object#clone: the copy no longer shares the memoized jsns builder and collections of the original (a clone of a created identity or cos sent the original name), and no longer raises when the original has no id
|
|
62
|
+
- [Added] Add RBS signatures for the public API in sig/ (cluster, config, errors, admin objects and collections, mailbox entry points), rake rbs:validate and rbs:test tasks
|
|
63
|
+
- [Added] Add massive update and delete in admin collection classes
|
|
64
|
+
- [Added] Add optional TLS certificate verification in ClusterConfig (ssl_verify, ssl_ca_file, ssl_ca_path), disabled by default
|
|
65
|
+
- [Changed] Cache only read SOAP requests (Get*, Search*, Count*): write and auth requests are no longer replayed from cache
|
|
66
|
+
- [Changed] Store cache entries with msgpack only (no Marshal), cache files created with 0600 and directories with 0700: existing cache entries are ignored
|
|
67
|
+
- [Fixed] Mask passwords, preauth and auth tokens in debug and verbose HTTP logs
|
|
68
|
+
- [Changed] Raise Zm::Error::ConnectionError (original Faraday error as cause) on connection failure, timeout and SSL error instead of Faraday errors
|
|
69
|
+
- [Fixed] REST download and read error messages were always empty (streamed body), error pages are no longer written to the destination file
|
|
70
|
+
- [Fixed] Alias, distribution list member and owner add!/remove! raised FrozenError on frozen emails and mutated the given strings
|
|
71
|
+
- [Changed] Utils.format_email raises ArgumentError on nil, non-String or blank email instead of NoMethodError
|
|
72
|
+
- [Fixed] Delegated account connector shared the cluster SOAP context: every following admin request carried the account header
|
|
73
|
+
- [Fixed] Server#mailboxes and AccountsCollection#quotas left the target server set on the cluster admin connector
|
|
74
|
+
- [Fixed] MessagesCollection#find_each(secure: true) looped forever when the search request failed
|
|
75
|
+
- [Changed] Replace require by autoload to reduce memory usage
|
|
76
|
+
- [Changed] Share the Zimbra attributes catalog between clusters using the same attributes file (CSV parsed and accessors defined once)
|
|
77
|
+
- [Changed] ZimbraAttribute keeps only name, type, immutable? and objects_scope (catalog memory reduced by about 65%): optionalIn, requiredIn, flags, cardinality, callback, value, max, min and since readers removed
|
|
78
|
+
- [Removed] Remove unused zimbra-attrs.json file from the gem
|
|
79
|
+
- [Removed] Remove ZimbraAttributesCollection#all_versioned (never set, always nil)
|
|
80
|
+
- [Changed] Reduce allocations when building objects from SOAP responses (about 90% fewer for accounts)
|
|
81
|
+
- [Changed] Autoload cache stores and msgpack: the default null_store no longer loads msgpack and FileStore (about 1.2 MB less)
|
|
82
|
+
- [Added] Add Zm::Support::Cache.storage(key), registered_storage may now hold constant names (Symbol) instead of classes
|
|
83
|
+
- [Fixed] Autoload ClusterConfigError and ClusterConfigDomain (NameError when referenced before ClusterConfig was loaded)
|
|
84
|
+
- [Fixed] Autoload Attachment and DlMembership (NameError when referenced before their collection was loaded)
|
|
85
|
+
- [Fixed] Require time explicitly: Time.parse (created_at, last_logon, appointments) only worked because csv loaded it
|
|
86
|
+
- [Fixed] DistributionListMembersCollection add!/remove! raise ArgumentError on nil instead of returning false
|
|
87
|
+
- [Changed] Change code structure files
|
|
88
|
+
- [Changed] Add secure option in messages find_each method
|
|
89
|
+
- [Changed] Require Ruby 3.3 minimum
|
|
90
|
+
- [Changed] Add csv and logger dependencies, remove bundler dependency, pin dependency major versions
|
|
91
|
+
- [Fixed] Fix default zimbra attributes file path in ClusterConfig
|
|
92
|
+
- [Fixed] Remove duplicated Recipient class in MessageRecipients
|
|
93
|
+
- [Fixed] Rename TagBuilder to TagsBuilder to match autoload (account tags raised NameError)
|
|
94
|
+
- [Fixed] Remove duplicated attribute accessors in SearchFolder
|
|
95
|
+
- [Fixed] Accept keyword attributes in admin update!, update_all! and mass_update! (local_transport! raised ArgumentError)
|
|
96
|
+
- [Fixed] Rescue Zm::Error::SoapError in mass_update! and mass_delete! (onerror option raised NameError)
|
|
97
|
+
- [Changed] Fix indentation in several collection classes
|
|
98
|
+
|
|
3
99
|
## Released [3.0.0]
|
|
4
100
|
|
|
5
101
|
### [3.0.0] 2025-12(27)
|
data/README.md
CHANGED
|
@@ -1,57 +1,158 @@
|
|
|
1
1
|
# zm-ruby-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://rubygems.org/gems/zm-ruby-client)
|
|
4
|
+

|
|
5
|
+
[](LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
**Zimbra and Carbonio in plain Ruby: code that reads like what it does.**
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
cluster.accounts.find_by(name: 'john@domain.tld').update!(zimbraAccountStatus: 'locked')
|
|
11
|
+
```
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
No XML, no SOAP envelopes, no token juggling. Read the line out loud, that's what it does.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
- **Readable**: short verbs (`find_by`, `where`, `save!`, `update!`, `delete!`) and chainable queries.
|
|
16
|
+
- **Complete**: admin side (accounts, domains, COS, distribution lists, servers…) and mailbox side
|
|
17
|
+
(messages, folders, contacts, calendars, tags, shares…), over both SOAP and REST.
|
|
18
|
+
- **Lightweight**: Ruby 3.3+, few dependencies, code autoloaded on demand.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
12
21
|
|
|
13
22
|
```bash
|
|
14
23
|
gem install zm-ruby-client
|
|
15
24
|
```
|
|
16
25
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
### Connection:
|
|
26
|
+
## Connect
|
|
20
27
|
|
|
21
28
|
```ruby
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
````
|
|
25
|
-
or
|
|
26
|
-
```ruby
|
|
29
|
+
require 'zm-ruby-client'
|
|
30
|
+
|
|
27
31
|
config = Zm::Client::ClusterConfig.new do |cc|
|
|
28
|
-
cc.zimbra_admin_url
|
|
29
|
-
cc.zimbra_admin_login
|
|
32
|
+
cc.zimbra_admin_url = 'https://mail.domain.tld:7071'
|
|
33
|
+
cc.zimbra_admin_login = 'admin@domain.tld'
|
|
30
34
|
cc.zimbra_admin_password = 'secret'
|
|
31
35
|
end
|
|
36
|
+
|
|
32
37
|
cluster = Zm::Client::Cluster.new(config)
|
|
33
38
|
cluster.login
|
|
34
|
-
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Prefer a file? `Zm::Client::ClusterConfig.new('config.json')` (or `.yml`), see [examples/config.json](examples/config.json).
|
|
42
|
+
|
|
43
|
+
TLS certificates are not verified by default. To enable verification:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
cc.ssl_verify = true
|
|
47
|
+
cc.ssl_ca_file = '/etc/ssl/certs/zimbra-ca.pem' # optional, for a private CA (or ssl_ca_path)
|
|
48
|
+
```
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
## Feel the difference
|
|
51
|
+
|
|
52
|
+
**Find an account, change it.**
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
account = cluster.accounts.find_by name: 'john@domain.tld'
|
|
56
|
+
account.zimbraAccountStatus # => "active"
|
|
57
|
+
|
|
58
|
+
account.update!(zimbraAccountStatus: 'locked')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Query LDAP like a database.** Pagination is handled for you.
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
cluster.accounts
|
|
65
|
+
.where('(zimbraLastLogonTimestamp<=20250101000000Z)')
|
|
66
|
+
.attrs('zimbraLastLogonTimestamp')
|
|
67
|
+
.find_each { |account| puts "#{account.name} last seen #{account.last_logon}" }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Lock every dormant account. One line.**
|
|
37
71
|
|
|
38
72
|
```ruby
|
|
39
|
-
|
|
40
|
-
accounts = cluster.accounts.where(filter).all
|
|
73
|
+
cluster.accounts.where('(zimbraLastLogonTimestamp<=20250101000000Z)').update_all!(zimbraAccountStatus: 'locked')
|
|
41
74
|
```
|
|
42
75
|
|
|
43
|
-
|
|
76
|
+
**Step into any mailbox, no user password needed.**
|
|
44
77
|
|
|
45
78
|
```ruby
|
|
46
|
-
account
|
|
79
|
+
account.login
|
|
80
|
+
|
|
81
|
+
account.messages.where('is:unread from:boss@domain.tld').all.each do |message|
|
|
82
|
+
puts "#{message.date} #{message.su}"
|
|
83
|
+
end
|
|
47
84
|
```
|
|
48
85
|
|
|
49
|
-
|
|
86
|
+
**Create anything with a block.**
|
|
50
87
|
|
|
51
88
|
```ruby
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
folder = account.folders.new do |f|
|
|
90
|
+
f.name = 'Invoices'
|
|
91
|
+
f.color = 3
|
|
54
92
|
end
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
93
|
+
folder.save!
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Import and export whole folders.**
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
account.folders.find(10).upload('holidays.ics') # Calendar
|
|
100
|
+
account.folders.find(2).download('inbox.tgz') # Inbox backup
|
|
101
|
+
account.folders.find(7).export_contacts # Contacts, as CSV
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Ask quick questions.**
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
cluster.email_exist?('john@domain.tld') # => true
|
|
108
|
+
cluster.accounts.where('(mail=*@domain.tld)').count # => 1250
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Type signatures
|
|
112
|
+
|
|
113
|
+
RBS signatures for the public API are shipped in `sig/`. [rbs collection](https://github.com/ruby/rbs) picks them up
|
|
114
|
+
from the installed gem, for use with [Steep](https://github.com/soutaro/steep) or your editor:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
bundle exec rbs collection install
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Upgrading from 3.0
|
|
121
|
+
|
|
122
|
+
3.1 requires Ruby 3.3, moves the error classes to `Zm::Error` (`rescue Zm::Error::SoapError`) and raises
|
|
123
|
+
`Zm::Error::ConnectionError` on network failures. The 3.0 names (`Zm::Client::SoapError`…) still work but print a
|
|
124
|
+
deprecation warning: they will be removed in 4.0. See the [upgrade notes](CHANGELOG.md#upgrading-from-30) for the
|
|
125
|
+
full list.
|
|
126
|
+
|
|
127
|
+
## Development
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bundle install
|
|
131
|
+
bundle exec rake test # offline unit tests, no server needed
|
|
132
|
+
bundle exec rake rbs:validate # check the RBS signatures
|
|
133
|
+
bundle exec rake rbs:test # unit tests with RBS runtime type checking
|
|
134
|
+
bundle exec rubocop
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Live tests** run real CRUD operations (accounts, domains, COS, distribution lists, resources, and the folders,
|
|
138
|
+
messages, contacts, appointments, tags, signatures and identities of an account) against a Zimbra or Carbonio server:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
ZIMBRA_ADMIN_URL=https://mail.domain.tld:7071 \
|
|
142
|
+
ZIMBRA_ADMIN_LOGIN=admin@domain.tld \
|
|
143
|
+
ZIMBRA_ADMIN_PASSWORD=secret \
|
|
144
|
+
bundle exec rake test:live
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Each test creates its own data (accounts, lists and resources in a temporary `zmlive-*.test` domain) and deletes it
|
|
148
|
+
afterwards, even when the test fails. They are skipped when a variable is missing. Set `ZIMBRA_LOG_PATH=/dev/stdout`
|
|
149
|
+
to see the SOAP requests. Use a test server: the tests need full admin rights and create and delete domains.
|
|
150
|
+
|
|
151
|
+
## Learn more
|
|
152
|
+
|
|
153
|
+
- [examples/](examples): ready-to-run scripts
|
|
154
|
+
- [CHANGELOG.md](CHANGELOG.md): what's new
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
GPL-3.0, by Maxime Désécot.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0
|
|
1
|
+
3.1.0
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'zm/client/account/account_aliases_collection'
|
|
4
|
-
|
|
5
3
|
module Zm
|
|
6
4
|
module Client
|
|
7
5
|
# objectClass: zimbraAccount
|
|
8
6
|
class Account < Base::MailboxObject
|
|
9
|
-
include RequestMethodsAdmin
|
|
7
|
+
include SoapRequest::RequestMethodsAdmin
|
|
10
8
|
|
|
11
9
|
# #################################################################
|
|
12
10
|
# Associations
|
|
13
11
|
# #################################################################
|
|
14
12
|
|
|
15
|
-
def aliases
|
|
16
|
-
return @aliases if defined? @aliases
|
|
17
|
-
|
|
18
|
-
@aliases = AccountAliasesCollection.new(self)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
def cos
|
|
22
14
|
return @cos if defined? @cos
|
|
23
15
|
|
|
@@ -45,12 +37,12 @@ module Zm
|
|
|
45
37
|
end
|
|
46
38
|
|
|
47
39
|
def build_flush_cache
|
|
48
|
-
soap_request = SoapElement.admin(SoapAdminConstants::FLUSH_CACHE_REQUEST)
|
|
49
|
-
node_cache = SoapElement.create('cache')
|
|
50
|
-
.add_attributes({ type: SoapConstants::ACCOUNT, allServers:
|
|
40
|
+
soap_request = Zm::SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::FLUSH_CACHE_REQUEST)
|
|
41
|
+
node_cache = Zm::SoapRequest::SoapElement.create('cache')
|
|
42
|
+
.add_attributes({ type: Zm::SoapRequest::SoapConstants::ACCOUNT, allServers: Zm::Utils::SearchUtils::ON })
|
|
51
43
|
soap_request.add_node(node_cache)
|
|
52
|
-
node_entry = SoapElement.create('entry')
|
|
53
|
-
.add_attribute(SoapConstants::BY, SoapConstants::ID)
|
|
44
|
+
node_entry = Zm::SoapRequest::SoapElement.create('entry')
|
|
45
|
+
.add_attribute(Zm::SoapRequest::SoapConstants::BY, SoapRequest::SoapConstants::ID)
|
|
54
46
|
.add_content(@id)
|
|
55
47
|
node_cache.add_node(node_entry)
|
|
56
48
|
soap_request
|
|
@@ -60,11 +52,7 @@ module Zm
|
|
|
60
52
|
@parent.zimbra_attributes.all_account_attrs_writable_names
|
|
61
53
|
end
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
return @jsns_builder if defined? @jsns_builder
|
|
65
|
-
|
|
66
|
-
@jsns_builder = AccountJsnsBuilder.new(self)
|
|
67
|
-
end
|
|
55
|
+
has_jsns_builder
|
|
68
56
|
|
|
69
57
|
def batch
|
|
70
58
|
return @batch if defined? @batch
|
|
@@ -72,6 +60,11 @@ module Zm
|
|
|
72
60
|
@batch = BatchRequest.new(soap_account_connector)
|
|
73
61
|
end
|
|
74
62
|
|
|
63
|
+
def empty_dumpster!
|
|
64
|
+
soap_request = Zm::SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::EMPTY_DUMPSTER_REQUEST)
|
|
65
|
+
soap_connector.invoke(soap_request)
|
|
66
|
+
end
|
|
67
|
+
|
|
75
68
|
private
|
|
76
69
|
|
|
77
70
|
def do_update!(hash)
|
|
@@ -14,7 +14,8 @@ module Zm
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def add!(email)
|
|
17
|
-
|
|
17
|
+
email = Utils.format_email(email)
|
|
18
|
+
return false if all.include?(email)
|
|
18
19
|
|
|
19
20
|
@parent.sac.invoke(build_add(email))
|
|
20
21
|
|
|
@@ -23,13 +24,14 @@ module Zm
|
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def build_add(email)
|
|
26
|
-
soap_request = SoapElement.admin(SoapAdminConstants::ADD_ACCOUNT_ALIAS_REQUEST)
|
|
27
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::ADD_ACCOUNT_ALIAS_REQUEST)
|
|
27
28
|
soap_request.add_attributes({ id: @parent.id, alias: email })
|
|
28
29
|
soap_request
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def remove!(email)
|
|
32
|
-
|
|
33
|
+
email = Utils.format_email(email)
|
|
34
|
+
return false unless all.include?(email)
|
|
33
35
|
|
|
34
36
|
@parent.sac.invoke(build_remove(email))
|
|
35
37
|
|
|
@@ -38,7 +40,7 @@ module Zm
|
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
def build_remove(email)
|
|
41
|
-
soap_request = SoapElement.admin(SoapAdminConstants::REMOVE_ACCOUNT_ALIAS_REQUEST)
|
|
43
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::REMOVE_ACCOUNT_ALIAS_REQUEST)
|
|
42
44
|
soap_request.add_attributes({ id: @parent.id, alias: email })
|
|
43
45
|
soap_request
|
|
44
46
|
end
|
|
@@ -5,6 +5,7 @@ module Zm
|
|
|
5
5
|
# Collection Account dls membership
|
|
6
6
|
class AccountDlsMembershipCollection < Base::ObjectsCollection
|
|
7
7
|
def initialize(parent)
|
|
8
|
+
super()
|
|
8
9
|
@parent = parent
|
|
9
10
|
end
|
|
10
11
|
|
|
@@ -13,9 +14,9 @@ module Zm
|
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def build_query
|
|
16
|
-
soap_request = SoapElement.admin(SoapAdminConstants::GET_ACCOUNT_MEMBERSHIP_REQUEST)
|
|
17
|
-
node_account = SoapElement.create(SoapConstants::ACCOUNT)
|
|
18
|
-
.add_attribute(SoapConstants::BY, SoapConstants::ID)
|
|
17
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_ACCOUNT_MEMBERSHIP_REQUEST)
|
|
18
|
+
node_account = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACCOUNT)
|
|
19
|
+
.add_attribute(SoapRequest::SoapConstants::BY, SoapRequest::SoapConstants::ID)
|
|
19
20
|
.add_content(@parent.id)
|
|
20
21
|
soap_request.add_node(node_account)
|
|
21
22
|
soap_request
|
|
@@ -5,6 +5,7 @@ module Zm
|
|
|
5
5
|
# Collection Account dls membership
|
|
6
6
|
class AccountDlsOwnerCollection < Base::ObjectsCollection
|
|
7
7
|
def initialize(parent)
|
|
8
|
+
super()
|
|
8
9
|
@parent = parent
|
|
9
10
|
end
|
|
10
11
|
|
|
@@ -15,10 +16,10 @@ module Zm
|
|
|
15
16
|
def build_query
|
|
16
17
|
jsns = {
|
|
17
18
|
query: "(zimbraACE=#{@parent.id} usr ownDistList)",
|
|
18
|
-
types:
|
|
19
|
+
types: :distributionlists
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
SoapElement.admin(SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
|
|
22
|
+
SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
|
|
22
23
|
.add_attributes(jsns)
|
|
23
24
|
end
|
|
24
25
|
|
|
@@ -15,7 +15,7 @@ module Zm
|
|
|
15
15
|
}
|
|
16
16
|
req.compact!
|
|
17
17
|
|
|
18
|
-
soap_request = SoapElement.admin(SoapAdminConstants::CREATE_ACCOUNT_REQUEST)
|
|
18
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::CREATE_ACCOUNT_REQUEST)
|
|
19
19
|
.add_attributes(req)
|
|
20
20
|
|
|
21
21
|
add_soap_request_nodes(soap_request)
|
|
@@ -32,15 +32,15 @@ module Zm
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def add_soap_request_node(soap_request, key, value)
|
|
35
|
-
node_attr = SoapElement.create(SoapConstants::A)
|
|
36
|
-
.add_attribute(SoapConstants::N, key)
|
|
35
|
+
node_attr = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::A)
|
|
36
|
+
.add_attribute(SoapRequest::SoapConstants::N, key)
|
|
37
37
|
.add_content(value)
|
|
38
38
|
soap_request.add_node(node_attr)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def to_update
|
|
42
|
-
soap_request = SoapElement.admin(SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
|
|
43
|
-
.add_attribute(SoapConstants::ID, @item.id)
|
|
42
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
|
|
43
|
+
.add_attribute(SoapRequest::SoapConstants::ID, @item.id)
|
|
44
44
|
|
|
45
45
|
add_soap_request_nodes(soap_request)
|
|
46
46
|
|
|
@@ -48,8 +48,8 @@ module Zm
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def to_patch(hash)
|
|
51
|
-
soap_request = SoapElement.admin(SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
|
|
52
|
-
.add_attribute(SoapConstants::ID, @item.id)
|
|
51
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::MODIFY_ACCOUNT_REQUEST)
|
|
52
|
+
.add_attribute(SoapRequest::SoapConstants::ID, @item.id)
|
|
53
53
|
|
|
54
54
|
hash.each do |key, values|
|
|
55
55
|
values = [values] unless values.is_a?(Array)
|
|
@@ -62,12 +62,12 @@ module Zm
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def to_delete
|
|
65
|
-
SoapElement.admin(SoapAdminConstants::DELETE_ACCOUNT_REQUEST)
|
|
66
|
-
.add_attribute(SoapConstants::ID, @item.id)
|
|
65
|
+
SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::DELETE_ACCOUNT_REQUEST)
|
|
66
|
+
.add_attribute(SoapRequest::SoapConstants::ID, @item.id)
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def to_rename(new_name)
|
|
70
|
-
SoapElement.admin(SoapAdminConstants::RENAME_ACCOUNT_REQUEST)
|
|
70
|
+
SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::RENAME_ACCOUNT_REQUEST)
|
|
71
71
|
.add_attributes({ id: @item.id, newName: new_name })
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -7,7 +7,7 @@ module Zm
|
|
|
7
7
|
def initialize(parent)
|
|
8
8
|
@child_class = Account
|
|
9
9
|
@builder_class = AccountsBuilder
|
|
10
|
-
@search_type =
|
|
10
|
+
@search_type = :accounts
|
|
11
11
|
super
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -19,24 +19,20 @@ module Zm
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def build_find_by(hash)
|
|
22
|
-
soap_request = SoapElement.admin(SoapAdminConstants::GET_ACCOUNT_REQUEST)
|
|
23
|
-
node_account = SoapElement.create(SoapConstants::ACCOUNT)
|
|
24
|
-
.add_attribute(SoapConstants::BY, hash.keys.first)
|
|
22
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_ACCOUNT_REQUEST)
|
|
23
|
+
node_account = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACCOUNT)
|
|
24
|
+
.add_attribute(SoapRequest::SoapConstants::BY, hash.keys.first)
|
|
25
25
|
.add_content(hash.values.first)
|
|
26
26
|
soap_request.add_node(node_account)
|
|
27
|
-
soap_request.add_attribute(SoapConstants::ATTRS, attrs_comma)
|
|
28
|
-
soap_request.add_attribute(SoapConstants::APPLY_COS, @apply_cos)
|
|
27
|
+
soap_request.add_attribute(SoapRequest::SoapConstants::ATTRS, attrs_comma)
|
|
28
|
+
soap_request.add_attribute(SoapRequest::SoapConstants::APPLY_COS, @apply_cos)
|
|
29
29
|
soap_request
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def quotas(domain_name: @domain_name, target_server_id: @target_server_id)
|
|
33
33
|
return nil if domain_name.nil? && target_server_id.nil?
|
|
34
34
|
|
|
35
|
-
if target_server_id.nil?
|
|
36
|
-
@all_servers = SoapUtils::ON
|
|
37
|
-
else
|
|
38
|
-
sac.context.target_server(target_server_id)
|
|
39
|
-
end
|
|
35
|
+
@all_servers = Zm::Utils::SearchUtils::ON if target_server_id.nil?
|
|
40
36
|
|
|
41
37
|
jsns = {
|
|
42
38
|
domain: domain_name,
|
|
@@ -49,11 +45,9 @@ module Zm
|
|
|
49
45
|
}
|
|
50
46
|
jsns.compact!
|
|
51
47
|
|
|
52
|
-
soap_request = SoapElement.admin(SoapAdminConstants::GET_QUOTA_USAGE_REQUEST)
|
|
48
|
+
soap_request = SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::GET_QUOTA_USAGE_REQUEST)
|
|
53
49
|
.add_attributes(jsns)
|
|
54
|
-
json = sac.invoke(soap_request)
|
|
55
|
-
|
|
56
|
-
sac.context.target_server(nil) unless target_server_id.nil?
|
|
50
|
+
json = target_server_id.nil? ? sac.invoke(soap_request) : sac.target_invoke(soap_request, target_server_id)
|
|
57
51
|
|
|
58
52
|
reset_query_params
|
|
59
53
|
@builder_class.new(@parent, json).make
|
|
@@ -63,7 +57,24 @@ module Zm
|
|
|
63
57
|
|
|
64
58
|
def reset_query_params
|
|
65
59
|
super
|
|
66
|
-
@attrs =
|
|
60
|
+
@attrs = %w[
|
|
61
|
+
displayName
|
|
62
|
+
zimbraId
|
|
63
|
+
cn
|
|
64
|
+
sn
|
|
65
|
+
zimbraMailHost
|
|
66
|
+
uid
|
|
67
|
+
zimbraCOSId
|
|
68
|
+
zimbraAccountStatus
|
|
69
|
+
zimbraLastLogonTimestamp
|
|
70
|
+
description
|
|
71
|
+
zimbraIsSystemAccount
|
|
72
|
+
zimbraIsDelegatedAdminAccount
|
|
73
|
+
zimbraAuthTokenValidityValue
|
|
74
|
+
zimbraMailStatus
|
|
75
|
+
zimbraIsAdminAccount
|
|
76
|
+
zimbraIsExternalVirtualAccount
|
|
77
|
+
]
|
|
67
78
|
end
|
|
68
79
|
end
|
|
69
80
|
end
|
data/lib/zm/client/ace/ace.rb
CHANGED
|
@@ -4,6 +4,9 @@ module Zm
|
|
|
4
4
|
module Client
|
|
5
5
|
# class account ace
|
|
6
6
|
class Ace < Base::Object
|
|
7
|
+
extend Zm::Relationship
|
|
8
|
+
has_jsns_builder
|
|
9
|
+
|
|
7
10
|
GT_USER = 'usr'
|
|
8
11
|
GT_GROUP = 'grp'
|
|
9
12
|
GT_DOMAIN = 'dom'
|
|
@@ -24,12 +27,6 @@ module Zm
|
|
|
24
27
|
@parent.soap_connector.invoke(jsns_builder.to_delete)
|
|
25
28
|
true
|
|
26
29
|
end
|
|
27
|
-
|
|
28
|
-
def jsns_builder
|
|
29
|
-
return @jsns_builder if defined? @jsns_builder
|
|
30
|
-
|
|
31
|
-
@jsns_builder = AceJsnsBuilder.new(self)
|
|
32
|
-
end
|
|
33
30
|
end
|
|
34
31
|
end
|
|
35
32
|
end
|
|
@@ -5,21 +5,21 @@ module Zm
|
|
|
5
5
|
# class for account ace jsns builder
|
|
6
6
|
class AceJsnsBuilder < Base::BaseJsnsBuilder
|
|
7
7
|
def to_find
|
|
8
|
-
soap_request = SoapElement.account(SoapAccountConstants::GET_RIGHTS_REQUEST)
|
|
8
|
+
soap_request = SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::GET_RIGHTS_REQUEST)
|
|
9
9
|
|
|
10
|
-
soap_request.add_attribute(SoapConstants::ACE, @item.rights.map { |r| { right: r } }) unless @item.rights.empty?
|
|
10
|
+
soap_request.add_attribute(SoapRequest::SoapConstants::ACE, @item.rights.map { |r| { right: r } }) unless @item.rights.empty?
|
|
11
11
|
|
|
12
12
|
soap_request
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def to_jsns
|
|
16
|
-
SoapElement.account(SoapAccountConstants::GRANT_RIGHTS_REQUEST)
|
|
17
|
-
.add_attribute(SoapConstants::ACE, attrs)
|
|
16
|
+
SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::GRANT_RIGHTS_REQUEST)
|
|
17
|
+
.add_attribute(SoapRequest::SoapConstants::ACE, attrs)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def to_delete
|
|
21
|
-
SoapElement.account(SoapAccountConstants::REVOKE_RIGHTS_REQUEST)
|
|
22
|
-
.add_attribute(SoapConstants::ACE, attrs)
|
|
21
|
+
SoapRequest::SoapElement.account(Zm::SoapRequest::SoapAccountConstants::REVOKE_RIGHTS_REQUEST)
|
|
22
|
+
.add_attribute(SoapRequest::SoapConstants::ACE, attrs)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def attrs
|