yandex360 3.2.0 → 4.0.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 +110 -1
- data/README.md +112 -121
- data/README.ru.md +109 -119
- data/lib/yandex360/client.rb +8 -1
- data/lib/yandex360/objects/types.rb +42 -0
- data/lib/yandex360/resources/departments.rb +5 -2
- data/lib/yandex360/resources/dns.rb +6 -3
- data/lib/yandex360/resources/domains.rb +42 -10
- data/lib/yandex360/resources/groups.rb +7 -0
- data/lib/yandex360/resources/mail_settings.rb +72 -0
- data/lib/yandex360/resources/organizations.rb +14 -4
- data/lib/yandex360/resources/two_fa.rb +35 -15
- data/lib/yandex360/resources/users.rb +2 -1
- data/lib/yandex360/version.rb +1 -1
- metadata +2 -2
- data/lib/yandex360/resources/post_settings.rb +0 -36
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Yandex360
|
|
4
|
+
# Mandatory two-factor authentication for the whole organization.
|
|
5
|
+
#
|
|
6
|
+
# All three operations share one path and differ only by verb, which is why
|
|
7
|
+
# there is no separate enable or disable endpoint to call.
|
|
8
|
+
#
|
|
9
|
+
# Per-employee two-factor authentication is not here: reading it is
|
|
10
|
+
# users.get2FA and clearing the phone is users.delete_2fa_phone, both on
|
|
11
|
+
# UserService.
|
|
12
|
+
#
|
|
13
|
+
# See https://yandex.ru/dev/api360/doc/ru/ref/Domain2FAService/
|
|
4
14
|
class TwoFaResource < Resource
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
include ParamBuilder
|
|
16
|
+
|
|
17
|
+
def status(org_id:)
|
|
18
|
+
validate_required_params({org_id: org_id}, [:org_id])
|
|
19
|
+
Domain2FA.new get(domain_path(org_id)).body
|
|
8
20
|
end
|
|
9
21
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
# duration is how long, in seconds, an employee may postpone setting 2FA up
|
|
23
|
+
# during sign-in. validation_method is "default" or "phone".
|
|
24
|
+
def enable(org_id:, duration:, logout_users: nil, validation_method: nil)
|
|
25
|
+
validate_required_params({org_id: org_id, duration: duration}, %i[org_id duration])
|
|
26
|
+
body = {duration: duration}
|
|
27
|
+
body[:logoutUsers] = logout_users unless logout_users.nil?
|
|
28
|
+
body[:validationMethod] = validation_method unless validation_method.nil?
|
|
29
|
+
|
|
30
|
+
Domain2FA.new post(domain_path(org_id), body: body).body
|
|
13
31
|
end
|
|
14
32
|
|
|
15
|
-
def
|
|
16
|
-
validate_required_params({org_id: org_id
|
|
17
|
-
|
|
33
|
+
def disable(org_id:)
|
|
34
|
+
validate_required_params({org_id: org_id}, [:org_id])
|
|
35
|
+
Domain2FA.new delete_request(domain_path(org_id)).body
|
|
18
36
|
end
|
|
19
37
|
|
|
38
|
+
# Deprecated: the name #status carried before this resource was corrected.
|
|
39
|
+
# Removed in 5.0.
|
|
20
40
|
def domain_status(org_id:)
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
warn "[yandex360] two_fa.domain_status is deprecated, use two_fa.status", uplevel: 1
|
|
42
|
+
status(org_id: org_id)
|
|
23
43
|
end
|
|
24
44
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def domain_path(org_id)
|
|
48
|
+
"/security/v1/org/#{org_id}/domain_2fa"
|
|
29
49
|
end
|
|
30
50
|
end
|
|
31
51
|
end
|
|
@@ -14,7 +14,8 @@ module Yandex360
|
|
|
14
14
|
validate_required_params({org_id: org_id, user_id: user_id, user_alias: user_alias},
|
|
15
15
|
%i[org_id user_id user_alias])
|
|
16
16
|
body = {alias: user_alias}
|
|
17
|
-
|
|
17
|
+
# The reply is the whole employee, aliases included, not the alias.
|
|
18
|
+
User.new post("/directory/v1/org/#{org_id}/users/#{user_id}/aliases", body: body).body
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def update(org_id:, user_id:, **user_params)
|
data/lib/yandex360/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yandex360
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ilya Brin
|
|
@@ -208,10 +208,10 @@ files:
|
|
|
208
208
|
- lib/yandex360/resources/domains.rb
|
|
209
209
|
- lib/yandex360/resources/external_contacts.rb
|
|
210
210
|
- lib/yandex360/resources/groups.rb
|
|
211
|
+
- lib/yandex360/resources/mail_settings.rb
|
|
211
212
|
- lib/yandex360/resources/mailboxes.rb
|
|
212
213
|
- lib/yandex360/resources/organizations.rb
|
|
213
214
|
- lib/yandex360/resources/passwords.rb
|
|
214
|
-
- lib/yandex360/resources/post_settings.rb
|
|
215
215
|
- lib/yandex360/resources/routing.rb
|
|
216
216
|
- lib/yandex360/resources/service_applications.rb
|
|
217
217
|
- lib/yandex360/resources/sessions.rb
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Yandex360
|
|
4
|
-
class PostSettingsResource < Resource
|
|
5
|
-
include ParamBuilder
|
|
6
|
-
|
|
7
|
-
def list(org_id:, user_id:)
|
|
8
|
-
validate_required_params({org_id: org_id, user_id: user_id}, %i[org_id user_id])
|
|
9
|
-
Response.new get("/directory/v1/org/#{org_id}/users/#{user_id}/settings/mail").body
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def update(org_id:, user_id:, **params)
|
|
13
|
-
validate_required_params({org_id: org_id, user_id: user_id}, %i[org_id user_id])
|
|
14
|
-
settings = build_params({}, params)
|
|
15
|
-
Response.new patch("/directory/v1/org/#{org_id}/users/#{user_id}/settings/mail", body: settings).body
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def forwarding_list(org_id:, user_id:)
|
|
19
|
-
validate_required_params({org_id: org_id, user_id: user_id}, %i[org_id user_id])
|
|
20
|
-
resp = get("/directory/v1/org/#{org_id}/users/#{user_id}/settings/mail/forwarding")
|
|
21
|
-
Collection.from_response(resp, key: "forwardings", type: Response)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def add_forwarding(org_id:, user_id:, address:)
|
|
25
|
-
validate_required_params({org_id: org_id, user_id: user_id, address: address}, %i[org_id user_id address])
|
|
26
|
-
body = {address: address}
|
|
27
|
-
Response.new post("/directory/v1/org/#{org_id}/users/#{user_id}/settings/mail/forwarding", body: body).body
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def delete_forwarding(org_id:, user_id:, address:)
|
|
31
|
-
validate_required_params({org_id: org_id, user_id: user_id, address: address}, %i[org_id user_id address])
|
|
32
|
-
path = "/directory/v1/org/#{org_id}/users/#{user_id}/settings/mail/forwarding/#{address}"
|
|
33
|
-
Response.new delete_request(path).body
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|