files.com 1.0.90
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +4 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +82 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/Rakefile +12 -0
- data/SECURITY.md +24 -0
- data/_VERSION +1 -0
- data/bin/files +8 -0
- data/bin/files-console +16 -0
- data/docs/account_line_item.md +41 -0
- data/docs/action.md +37 -0
- data/docs/api_key.md +202 -0
- data/docs/app.md +57 -0
- data/docs/as2_key.md +133 -0
- data/docs/auto.md +11 -0
- data/docs/automation.md +190 -0
- data/docs/behavior.md +208 -0
- data/docs/bundle.md +252 -0
- data/docs/bundle_download.md +35 -0
- data/docs/clickwrap.md +143 -0
- data/docs/dns_record.md +35 -0
- data/docs/errors.md +17 -0
- data/docs/file.md +204 -0
- data/docs/file_action.md +126 -0
- data/docs/file_comment.md +116 -0
- data/docs/file_comment_reaction.md +62 -0
- data/docs/file_part_upload.md +37 -0
- data/docs/file_utils.md +4 -0
- data/docs/folder.md +90 -0
- data/docs/group.md +153 -0
- data/docs/group_user.md +124 -0
- data/docs/history.md +171 -0
- data/docs/history_export.md +174 -0
- data/docs/image.md +13 -0
- data/docs/invoice.md +72 -0
- data/docs/invoice_line_item.md +27 -0
- data/docs/ip_address.md +55 -0
- data/docs/lock.md +98 -0
- data/docs/message.md +147 -0
- data/docs/message_comment.md +132 -0
- data/docs/message_comment_reaction.md +94 -0
- data/docs/message_reaction.md +94 -0
- data/docs/notification.md +177 -0
- data/docs/payment.md +72 -0
- data/docs/payment_line_item.md +19 -0
- data/docs/permission.md +95 -0
- data/docs/preview.md +19 -0
- data/docs/project.md +121 -0
- data/docs/public_ip_address.md +13 -0
- data/docs/public_key.md +133 -0
- data/docs/remote_server.md +356 -0
- data/docs/request.md +100 -0
- data/docs/session.md +78 -0
- data/docs/site.md +448 -0
- data/docs/sso_strategy.md +114 -0
- data/docs/status.md +21 -0
- data/docs/style.md +93 -0
- data/docs/usage_daily_snapshot.md +45 -0
- data/docs/usage_snapshot.md +53 -0
- data/docs/user.md +535 -0
- data/docs/user_cipher_use.md +41 -0
- data/docs/user_request.md +93 -0
- data/files.com.gemspec +22 -0
- data/lib/files.com.rb +184 -0
- data/lib/files.com/api.rb +38 -0
- data/lib/files.com/api_client.rb +340 -0
- data/lib/files.com/errors.rb +41 -0
- data/lib/files.com/list.rb +95 -0
- data/lib/files.com/models/account_line_item.rb +82 -0
- data/lib/files.com/models/action.rb +77 -0
- data/lib/files.com/models/api_key.rb +270 -0
- data/lib/files.com/models/app.rb +101 -0
- data/lib/files.com/models/as2_key.rb +179 -0
- data/lib/files.com/models/auto.rb +17 -0
- data/lib/files.com/models/automation.rb +304 -0
- data/lib/files.com/models/behavior.rb +266 -0
- data/lib/files.com/models/bundle.rb +371 -0
- data/lib/files.com/models/bundle_download.rb +49 -0
- data/lib/files.com/models/clickwrap.rb +197 -0
- data/lib/files.com/models/dir.rb +3 -0
- data/lib/files.com/models/dns_record.rb +51 -0
- data/lib/files.com/models/errors.rb +22 -0
- data/lib/files.com/models/file.rb +968 -0
- data/lib/files.com/models/file_action.rb +126 -0
- data/lib/files.com/models/file_comment.rb +146 -0
- data/lib/files.com/models/file_comment_reaction.rb +100 -0
- data/lib/files.com/models/file_part_upload.rb +82 -0
- data/lib/files.com/models/file_utils.rb +118 -0
- data/lib/files.com/models/folder.rb +357 -0
- data/lib/files.com/models/group.rb +208 -0
- data/lib/files.com/models/group_user.rb +171 -0
- data/lib/files.com/models/history.rb +228 -0
- data/lib/files.com/models/history_export.rb +353 -0
- data/lib/files.com/models/image.rb +22 -0
- data/lib/files.com/models/invoice.rb +117 -0
- data/lib/files.com/models/invoice_line_item.rb +57 -0
- data/lib/files.com/models/ip_address.rb +66 -0
- data/lib/files.com/models/lock.rb +173 -0
- data/lib/files.com/models/message.rb +201 -0
- data/lib/files.com/models/message_comment.rb +165 -0
- data/lib/files.com/models/message_comment_reaction.rb +128 -0
- data/lib/files.com/models/message_reaction.rb +128 -0
- data/lib/files.com/models/notification.rb +263 -0
- data/lib/files.com/models/payment.rb +117 -0
- data/lib/files.com/models/payment_line_item.rb +37 -0
- data/lib/files.com/models/permission.rb +172 -0
- data/lib/files.com/models/preview.rb +37 -0
- data/lib/files.com/models/project.rb +140 -0
- data/lib/files.com/models/public_ip_address.rb +22 -0
- data/lib/files.com/models/public_key.rb +179 -0
- data/lib/files.com/models/remote_server.rb +680 -0
- data/lib/files.com/models/request.rb +179 -0
- data/lib/files.com/models/session.rb +247 -0
- data/lib/files.com/models/site.rb +733 -0
- data/lib/files.com/models/sso_strategy.rb +227 -0
- data/lib/files.com/models/status.rb +37 -0
- data/lib/files.com/models/style.rb +131 -0
- data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
- data/lib/files.com/models/usage_snapshot.rb +96 -0
- data/lib/files.com/models/user.rb +876 -0
- data/lib/files.com/models/user_cipher_use.rb +63 -0
- data/lib/files.com/models/user_request.rb +127 -0
- data/lib/files.com/response.rb +25 -0
- data/lib/files.com/sizable_io.rb +32 -0
- data/lib/files.com/system_profiler.rb +56 -0
- data/lib/files.com/util.rb +106 -0
- data/lib/files.com/version.rb +5 -0
- data/spec/list_spec.rb +214 -0
- data/spec/models/file_spec.rb +68 -0
- data/spec/models/folder_spec.rb +40 -0
- data/spec/spec_helper.rb +36 -0
- data/test.sh +8 -0
- data/test/test.rb +75 -0
- metadata +235 -0
@@ -0,0 +1,179 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Request
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Request ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
22
|
+
def path
|
23
|
+
@attributes[:path]
|
24
|
+
end
|
25
|
+
|
26
|
+
def path=(value)
|
27
|
+
@attributes[:path] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# string - Source filename, if applicable
|
31
|
+
def source
|
32
|
+
@attributes[:source]
|
33
|
+
end
|
34
|
+
|
35
|
+
def source=(value)
|
36
|
+
@attributes[:source] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# string - Destination filename
|
40
|
+
def destination
|
41
|
+
@attributes[:destination]
|
42
|
+
end
|
43
|
+
|
44
|
+
def destination=(value)
|
45
|
+
@attributes[:destination] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# string - ID of automation that created request
|
49
|
+
def automation_id
|
50
|
+
@attributes[:automation_id]
|
51
|
+
end
|
52
|
+
|
53
|
+
def automation_id=(value)
|
54
|
+
@attributes[:automation_id] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# string - User making the request (if applicable)
|
58
|
+
def user_display_name
|
59
|
+
@attributes[:user_display_name]
|
60
|
+
end
|
61
|
+
|
62
|
+
def user_display_name=(value)
|
63
|
+
@attributes[:user_display_name] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
|
67
|
+
def user_ids
|
68
|
+
@attributes[:user_ids]
|
69
|
+
end
|
70
|
+
|
71
|
+
def user_ids=(value)
|
72
|
+
@attributes[:user_ids] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
|
76
|
+
def group_ids
|
77
|
+
@attributes[:group_ids]
|
78
|
+
end
|
79
|
+
|
80
|
+
def group_ids=(value)
|
81
|
+
@attributes[:group_ids] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
def save
|
85
|
+
if @attributes[:path]
|
86
|
+
raise NotImplementedError.new("The Request object doesn't support updates.")
|
87
|
+
else
|
88
|
+
new_obj = Request.create(@attributes, @options)
|
89
|
+
@attributes = new_obj.attributes
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parameters:
|
94
|
+
# page - int64 - Current page number.
|
95
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
96
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
97
|
+
# cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
|
98
|
+
# sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
|
99
|
+
# mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
|
100
|
+
# path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
|
101
|
+
def self.list(path, params = {}, options = {})
|
102
|
+
params ||= {}
|
103
|
+
params[:path] = path
|
104
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
105
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
106
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
107
|
+
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
|
108
|
+
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
|
109
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
110
|
+
|
111
|
+
List.new(Request, params) do
|
112
|
+
Api.send_request("/requests", :get, params, options)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.all(path, params = {}, options = {})
|
117
|
+
list(path, params, options)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Parameters:
|
121
|
+
# page - int64 - Current page number.
|
122
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
123
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
124
|
+
# cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
|
125
|
+
# sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
|
126
|
+
# mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
|
127
|
+
# path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
|
128
|
+
def self.find_folder(path, params = {}, options = {})
|
129
|
+
params ||= {}
|
130
|
+
params[:path] = path
|
131
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
132
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
133
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
134
|
+
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
|
135
|
+
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
|
136
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
137
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
138
|
+
|
139
|
+
List.new(Request, params) do
|
140
|
+
Api.send_request("/requests/folders/#{params[:path]}", :get, params, options)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Parameters:
|
145
|
+
# path (required) - string - Folder path on which to request the file.
|
146
|
+
# destination (required) - string - Destination filename (without extension) to request.
|
147
|
+
# user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
|
148
|
+
# group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
|
149
|
+
def self.create(path, params = {}, options = {})
|
150
|
+
params ||= {}
|
151
|
+
params[:path] = path
|
152
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
153
|
+
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
|
154
|
+
raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
|
155
|
+
raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String)
|
156
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
157
|
+
raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
|
158
|
+
|
159
|
+
response, options = Api.send_request("/requests", :post, params, options)
|
160
|
+
Request.new(response.data, options)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Parameters:
|
164
|
+
# id (required) - int64 - Request ID.
|
165
|
+
def self.delete(id, params = {}, options = {})
|
166
|
+
params ||= {}
|
167
|
+
params[:id] = id
|
168
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
169
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
170
|
+
|
171
|
+
response, _options = Api.send_request("/requests/#{params[:id]}", :delete, params, options)
|
172
|
+
response.data
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.destroy(id, params = {}, options = {})
|
176
|
+
delete(id, params, options)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Session
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def destroy(params = {}, options = {})
|
8
|
+
Session.destroy(params, options.merge(session: self, session_id: nil))
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(attributes = {}, options = {})
|
12
|
+
@attributes = attributes || {}
|
13
|
+
@options = options || {}
|
14
|
+
end
|
15
|
+
|
16
|
+
# string - Session ID
|
17
|
+
def id
|
18
|
+
@attributes[:id]
|
19
|
+
end
|
20
|
+
|
21
|
+
def id=(value)
|
22
|
+
@attributes[:id] = value
|
23
|
+
end
|
24
|
+
|
25
|
+
# string - Session language
|
26
|
+
def language
|
27
|
+
@attributes[:language]
|
28
|
+
end
|
29
|
+
|
30
|
+
def language=(value)
|
31
|
+
@attributes[:language] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
# string - Login token. If set, this token will allow your user to log in via browser at the domain in `login_token_domain`.
|
35
|
+
def login_token
|
36
|
+
@attributes[:login_token]
|
37
|
+
end
|
38
|
+
|
39
|
+
def login_token=(value)
|
40
|
+
@attributes[:login_token] = value
|
41
|
+
end
|
42
|
+
|
43
|
+
# string - Domain to use with `login_token`.
|
44
|
+
def login_token_domain
|
45
|
+
@attributes[:login_token_domain]
|
46
|
+
end
|
47
|
+
|
48
|
+
def login_token_domain=(value)
|
49
|
+
@attributes[:login_token_domain] = value
|
50
|
+
end
|
51
|
+
|
52
|
+
# int64 - Maximum number of files to retrieve per folder for a directory listing. This is based on the user's plan.
|
53
|
+
def max_dir_listing_size
|
54
|
+
@attributes[:max_dir_listing_size]
|
55
|
+
end
|
56
|
+
|
57
|
+
def max_dir_listing_size=(value)
|
58
|
+
@attributes[:max_dir_listing_size] = value
|
59
|
+
end
|
60
|
+
|
61
|
+
# boolean - Can access multiple regions?
|
62
|
+
def multiple_regions
|
63
|
+
@attributes[:multiple_regions]
|
64
|
+
end
|
65
|
+
|
66
|
+
def multiple_regions=(value)
|
67
|
+
@attributes[:multiple_regions] = value
|
68
|
+
end
|
69
|
+
|
70
|
+
# boolean - Is this session read only?
|
71
|
+
def read_only
|
72
|
+
@attributes[:read_only]
|
73
|
+
end
|
74
|
+
|
75
|
+
def read_only=(value)
|
76
|
+
@attributes[:read_only] = value
|
77
|
+
end
|
78
|
+
|
79
|
+
# string - Initial root path to start the user's session in.
|
80
|
+
def root_path
|
81
|
+
@attributes[:root_path]
|
82
|
+
end
|
83
|
+
|
84
|
+
def root_path=(value)
|
85
|
+
@attributes[:root_path] = value
|
86
|
+
end
|
87
|
+
|
88
|
+
# int64 - Site ID
|
89
|
+
def site_id
|
90
|
+
@attributes[:site_id]
|
91
|
+
end
|
92
|
+
|
93
|
+
def site_id=(value)
|
94
|
+
@attributes[:site_id] = value
|
95
|
+
end
|
96
|
+
|
97
|
+
# boolean - Is SSL required for this user? (If so, ensure all your communications with this user use SSL.)
|
98
|
+
def ssl_required
|
99
|
+
@attributes[:ssl_required]
|
100
|
+
end
|
101
|
+
|
102
|
+
def ssl_required=(value)
|
103
|
+
@attributes[:ssl_required] = value
|
104
|
+
end
|
105
|
+
|
106
|
+
# boolean - Is strong TLS disabled for this user? (If this is set to true, the site administrator has signaled that it is ok to use less secure TLS versions for this user.)
|
107
|
+
def tls_disabled
|
108
|
+
@attributes[:tls_disabled]
|
109
|
+
end
|
110
|
+
|
111
|
+
def tls_disabled=(value)
|
112
|
+
@attributes[:tls_disabled] = value
|
113
|
+
end
|
114
|
+
|
115
|
+
# boolean - If true, this user needs to add a Two Factor Authentication method before performing any further actions.
|
116
|
+
def two_factor_setup_needed
|
117
|
+
@attributes[:two_factor_setup_needed]
|
118
|
+
end
|
119
|
+
|
120
|
+
def two_factor_setup_needed=(value)
|
121
|
+
@attributes[:two_factor_setup_needed] = value
|
122
|
+
end
|
123
|
+
|
124
|
+
# boolean - Sent only if 2FA setup is needed. Is SMS two factor authentication allowed?
|
125
|
+
def allowed_2fa_method_sms
|
126
|
+
@attributes[:allowed_2fa_method_sms]
|
127
|
+
end
|
128
|
+
|
129
|
+
def allowed_2fa_method_sms=(value)
|
130
|
+
@attributes[:allowed_2fa_method_sms] = value
|
131
|
+
end
|
132
|
+
|
133
|
+
# boolean - Sent only if 2FA setup is needed. Is TOTP two factor authentication allowed?
|
134
|
+
def allowed_2fa_method_totp
|
135
|
+
@attributes[:allowed_2fa_method_totp]
|
136
|
+
end
|
137
|
+
|
138
|
+
def allowed_2fa_method_totp=(value)
|
139
|
+
@attributes[:allowed_2fa_method_totp] = value
|
140
|
+
end
|
141
|
+
|
142
|
+
# boolean - Sent only if 2FA setup is needed. Is U2F two factor authentication allowed?
|
143
|
+
def allowed_2fa_method_u2f
|
144
|
+
@attributes[:allowed_2fa_method_u2f]
|
145
|
+
end
|
146
|
+
|
147
|
+
def allowed_2fa_method_u2f=(value)
|
148
|
+
@attributes[:allowed_2fa_method_u2f] = value
|
149
|
+
end
|
150
|
+
|
151
|
+
# boolean - Sent only if 2FA setup is needed. Is Yubikey two factor authentication allowed?
|
152
|
+
def allowed_2fa_method_yubi
|
153
|
+
@attributes[:allowed_2fa_method_yubi]
|
154
|
+
end
|
155
|
+
|
156
|
+
def allowed_2fa_method_yubi=(value)
|
157
|
+
@attributes[:allowed_2fa_method_yubi] = value
|
158
|
+
end
|
159
|
+
|
160
|
+
# boolean - Allow the user to provide file/folder modified at dates? If false, the server will always use the current date/time.
|
161
|
+
def use_provided_modified_at
|
162
|
+
@attributes[:use_provided_modified_at]
|
163
|
+
end
|
164
|
+
|
165
|
+
def use_provided_modified_at=(value)
|
166
|
+
@attributes[:use_provided_modified_at] = value
|
167
|
+
end
|
168
|
+
|
169
|
+
# boolean - Does this user want to use Windows line-ending emulation? (CR vs CRLF)
|
170
|
+
def windows_mode_ftp
|
171
|
+
@attributes[:windows_mode_ftp]
|
172
|
+
end
|
173
|
+
|
174
|
+
def windows_mode_ftp=(value)
|
175
|
+
@attributes[:windows_mode_ftp] = value
|
176
|
+
end
|
177
|
+
|
178
|
+
# string - Username to sign in as
|
179
|
+
def username
|
180
|
+
@attributes[:username]
|
181
|
+
end
|
182
|
+
|
183
|
+
def username=(value)
|
184
|
+
@attributes[:username] = value
|
185
|
+
end
|
186
|
+
|
187
|
+
# string - Password for sign in
|
188
|
+
def password
|
189
|
+
@attributes[:password]
|
190
|
+
end
|
191
|
+
|
192
|
+
def password=(value)
|
193
|
+
@attributes[:password] = value
|
194
|
+
end
|
195
|
+
|
196
|
+
# string - If this user has a 2FA device, provide its OTP or code here.
|
197
|
+
def otp
|
198
|
+
@attributes[:otp]
|
199
|
+
end
|
200
|
+
|
201
|
+
def otp=(value)
|
202
|
+
@attributes[:otp] = value
|
203
|
+
end
|
204
|
+
|
205
|
+
# string - Identifier for a partially-completed login
|
206
|
+
def partial_session_id
|
207
|
+
@attributes[:partial_session_id]
|
208
|
+
end
|
209
|
+
|
210
|
+
def partial_session_id=(value)
|
211
|
+
@attributes[:partial_session_id] = value
|
212
|
+
end
|
213
|
+
|
214
|
+
def save
|
215
|
+
if @attributes[:id]
|
216
|
+
raise NotImplementedError.new("The Session object doesn't support updates.")
|
217
|
+
else
|
218
|
+
new_obj = Session.create(@attributes, @options)
|
219
|
+
@attributes = new_obj.attributes
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Parameters:
|
224
|
+
# username - string - Username to sign in as
|
225
|
+
# password - string - Password for sign in
|
226
|
+
# otp - string - If this user has a 2FA device, provide its OTP or code here.
|
227
|
+
# partial_session_id - string - Identifier for a partially-completed login
|
228
|
+
def self.create(params = {}, options = {})
|
229
|
+
raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String)
|
230
|
+
raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
|
231
|
+
raise InvalidParameterError.new("Bad parameter: otp must be an String") if params.dig(:otp) and !params.dig(:otp).is_a?(String)
|
232
|
+
raise InvalidParameterError.new("Bad parameter: partial_session_id must be an String") if params.dig(:partial_session_id) and !params.dig(:partial_session_id).is_a?(String)
|
233
|
+
|
234
|
+
response, options = Api.send_request("/sessions", :post, params, options)
|
235
|
+
Session.new(response.data, options)
|
236
|
+
end
|
237
|
+
|
238
|
+
def self.delete(params = {}, options = {})
|
239
|
+
response, _options = Api.send_request("/sessions", :delete, params, options)
|
240
|
+
response.data
|
241
|
+
end
|
242
|
+
|
243
|
+
def self.destroy(params = {}, options = {})
|
244
|
+
delete(params, options)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,733 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Site
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# string - Site name
|
13
|
+
def name
|
14
|
+
@attributes[:name]
|
15
|
+
end
|
16
|
+
|
17
|
+
# boolean - Is SMS two factor authentication allowed?
|
18
|
+
def allowed_2fa_method_sms
|
19
|
+
@attributes[:allowed_2fa_method_sms]
|
20
|
+
end
|
21
|
+
|
22
|
+
# boolean - Is TOTP two factor authentication allowed?
|
23
|
+
def allowed_2fa_method_totp
|
24
|
+
@attributes[:allowed_2fa_method_totp]
|
25
|
+
end
|
26
|
+
|
27
|
+
# boolean - Is U2F two factor authentication allowed?
|
28
|
+
def allowed_2fa_method_u2f
|
29
|
+
@attributes[:allowed_2fa_method_u2f]
|
30
|
+
end
|
31
|
+
|
32
|
+
# boolean - Is yubikey two factor authentication allowed?
|
33
|
+
def allowed_2fa_method_yubi
|
34
|
+
@attributes[:allowed_2fa_method_yubi]
|
35
|
+
end
|
36
|
+
|
37
|
+
# int64 - User ID for the main site administrator
|
38
|
+
def admin_user_id
|
39
|
+
@attributes[:admin_user_id]
|
40
|
+
end
|
41
|
+
|
42
|
+
# boolean - Are manual Bundle names allowed?
|
43
|
+
def allow_bundle_names
|
44
|
+
@attributes[:allow_bundle_names]
|
45
|
+
end
|
46
|
+
|
47
|
+
# string - List of allowed IP addresses
|
48
|
+
def allowed_ips
|
49
|
+
@attributes[:allowed_ips]
|
50
|
+
end
|
51
|
+
|
52
|
+
# boolean - If false, rename conflicting files instead of asking for overwrite confirmation. Only applies to web interface.
|
53
|
+
def ask_about_overwrites
|
54
|
+
@attributes[:ask_about_overwrites]
|
55
|
+
end
|
56
|
+
|
57
|
+
# int64 - Site-wide Bundle expiration in days
|
58
|
+
def bundle_expiration
|
59
|
+
@attributes[:bundle_expiration]
|
60
|
+
end
|
61
|
+
|
62
|
+
# boolean - Do Bundles require password protection?
|
63
|
+
def bundle_password_required
|
64
|
+
@attributes[:bundle_password_required]
|
65
|
+
end
|
66
|
+
|
67
|
+
# string - Page link and button color
|
68
|
+
def color2_left
|
69
|
+
@attributes[:color2_left]
|
70
|
+
end
|
71
|
+
|
72
|
+
# string - Top bar link color
|
73
|
+
def color2_link
|
74
|
+
@attributes[:color2_link]
|
75
|
+
end
|
76
|
+
|
77
|
+
# string - Page link and button color
|
78
|
+
def color2_text
|
79
|
+
@attributes[:color2_text]
|
80
|
+
end
|
81
|
+
|
82
|
+
# string - Top bar background color
|
83
|
+
def color2_top
|
84
|
+
@attributes[:color2_top]
|
85
|
+
end
|
86
|
+
|
87
|
+
# string - Top bar text color
|
88
|
+
def color2_top_text
|
89
|
+
@attributes[:color2_top_text]
|
90
|
+
end
|
91
|
+
|
92
|
+
# date-time - Time this site was created
|
93
|
+
def created_at
|
94
|
+
@attributes[:created_at]
|
95
|
+
end
|
96
|
+
|
97
|
+
# string - Preferred currency
|
98
|
+
def currency
|
99
|
+
@attributes[:currency]
|
100
|
+
end
|
101
|
+
|
102
|
+
# boolean - Is this site using a custom namespace for users?
|
103
|
+
def custom_namespace
|
104
|
+
@attributes[:custom_namespace]
|
105
|
+
end
|
106
|
+
|
107
|
+
# int64 - Number of days to keep deleted files
|
108
|
+
def days_to_retain_backups
|
109
|
+
@attributes[:days_to_retain_backups]
|
110
|
+
end
|
111
|
+
|
112
|
+
# string - Site default time zone
|
113
|
+
def default_time_zone
|
114
|
+
@attributes[:default_time_zone]
|
115
|
+
end
|
116
|
+
|
117
|
+
# boolean - Is the desktop app enabled?
|
118
|
+
def desktop_app
|
119
|
+
@attributes[:desktop_app]
|
120
|
+
end
|
121
|
+
|
122
|
+
# boolean - Is desktop app session IP pinning enabled?
|
123
|
+
def desktop_app_session_ip_pinning
|
124
|
+
@attributes[:desktop_app_session_ip_pinning]
|
125
|
+
end
|
126
|
+
|
127
|
+
# int64 - Desktop app session lifetime (in hours)
|
128
|
+
def desktop_app_session_lifetime
|
129
|
+
@attributes[:desktop_app_session_lifetime]
|
130
|
+
end
|
131
|
+
|
132
|
+
# boolean - Are notifications disabled?
|
133
|
+
def disable_notifications
|
134
|
+
@attributes[:disable_notifications]
|
135
|
+
end
|
136
|
+
|
137
|
+
# boolean - Is password reset disabled?
|
138
|
+
def disable_password_reset
|
139
|
+
@attributes[:disable_password_reset]
|
140
|
+
end
|
141
|
+
|
142
|
+
# string - Custom domain
|
143
|
+
def domain
|
144
|
+
@attributes[:domain]
|
145
|
+
end
|
146
|
+
|
147
|
+
# email - Main email for this site
|
148
|
+
def email
|
149
|
+
@attributes[:email]
|
150
|
+
end
|
151
|
+
|
152
|
+
# boolean - If true, groups can be manually created / modified / deleted by Site Admins. Otherwise, groups can only be managed via your SSO provider.
|
153
|
+
def non_sso_groups_allowed
|
154
|
+
@attributes[:non_sso_groups_allowed]
|
155
|
+
end
|
156
|
+
|
157
|
+
# boolean - If true, users can be manually created / modified / deleted by Site Admins. Otherwise, users can only be managed via your SSO provider.
|
158
|
+
def non_sso_users_allowed
|
159
|
+
@attributes[:non_sso_users_allowed]
|
160
|
+
end
|
161
|
+
|
162
|
+
# boolean - If true, permissions for this site must be bound to a group (not a user). Otherwise, permissions must be bound to a user.
|
163
|
+
def folder_permissions_groups_only
|
164
|
+
@attributes[:folder_permissions_groups_only]
|
165
|
+
end
|
166
|
+
|
167
|
+
# boolean - Is there a signed HIPAA BAA between Files.com and this site?
|
168
|
+
def hipaa
|
169
|
+
@attributes[:hipaa]
|
170
|
+
end
|
171
|
+
|
172
|
+
# Branded icon 128x128
|
173
|
+
def icon128
|
174
|
+
@attributes[:icon128]
|
175
|
+
end
|
176
|
+
|
177
|
+
# Branded icon 16x16
|
178
|
+
def icon16
|
179
|
+
@attributes[:icon16]
|
180
|
+
end
|
181
|
+
|
182
|
+
# Branded icon 32x32
|
183
|
+
def icon32
|
184
|
+
@attributes[:icon32]
|
185
|
+
end
|
186
|
+
|
187
|
+
# Branded icon 48x48
|
188
|
+
def icon48
|
189
|
+
@attributes[:icon48]
|
190
|
+
end
|
191
|
+
|
192
|
+
# date-time - Can files be modified?
|
193
|
+
def immutable_files_set_at
|
194
|
+
@attributes[:immutable_files_set_at]
|
195
|
+
end
|
196
|
+
|
197
|
+
# boolean - Include password in emails to new users?
|
198
|
+
def include_password_in_welcome_email
|
199
|
+
@attributes[:include_password_in_welcome_email]
|
200
|
+
end
|
201
|
+
|
202
|
+
# string - Site default language
|
203
|
+
def language
|
204
|
+
@attributes[:language]
|
205
|
+
end
|
206
|
+
|
207
|
+
# string - Base DN for looking up users in LDAP server
|
208
|
+
def ldap_base_dn
|
209
|
+
@attributes[:ldap_base_dn]
|
210
|
+
end
|
211
|
+
|
212
|
+
# string - Domain name that will be appended to usernames
|
213
|
+
def ldap_domain
|
214
|
+
@attributes[:ldap_domain]
|
215
|
+
end
|
216
|
+
|
217
|
+
# boolean - Main LDAP setting: is LDAP enabled?
|
218
|
+
def ldap_enabled
|
219
|
+
@attributes[:ldap_enabled]
|
220
|
+
end
|
221
|
+
|
222
|
+
# string - Should we sync groups from LDAP server?
|
223
|
+
def ldap_group_action
|
224
|
+
@attributes[:ldap_group_action]
|
225
|
+
end
|
226
|
+
|
227
|
+
# string - Comma or newline separated list of group names (with optional wildcards) to exclude when syncing.
|
228
|
+
def ldap_group_exclusion
|
229
|
+
@attributes[:ldap_group_exclusion]
|
230
|
+
end
|
231
|
+
|
232
|
+
# string - Comma or newline separated list of group names (with optional wildcards) to include when syncing.
|
233
|
+
def ldap_group_inclusion
|
234
|
+
@attributes[:ldap_group_inclusion]
|
235
|
+
end
|
236
|
+
|
237
|
+
# string - LDAP host
|
238
|
+
def ldap_host
|
239
|
+
@attributes[:ldap_host]
|
240
|
+
end
|
241
|
+
|
242
|
+
# string - LDAP backup host
|
243
|
+
def ldap_host_2
|
244
|
+
@attributes[:ldap_host_2]
|
245
|
+
end
|
246
|
+
|
247
|
+
# string - LDAP backup host
|
248
|
+
def ldap_host_3
|
249
|
+
@attributes[:ldap_host_3]
|
250
|
+
end
|
251
|
+
|
252
|
+
# int64 - LDAP port
|
253
|
+
def ldap_port
|
254
|
+
@attributes[:ldap_port]
|
255
|
+
end
|
256
|
+
|
257
|
+
# boolean - Use secure LDAP?
|
258
|
+
def ldap_secure
|
259
|
+
@attributes[:ldap_secure]
|
260
|
+
end
|
261
|
+
|
262
|
+
# string - LDAP type
|
263
|
+
def ldap_type
|
264
|
+
@attributes[:ldap_type]
|
265
|
+
end
|
266
|
+
|
267
|
+
# string - Should we sync users from LDAP server?
|
268
|
+
def ldap_user_action
|
269
|
+
@attributes[:ldap_user_action]
|
270
|
+
end
|
271
|
+
|
272
|
+
# string - Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
|
273
|
+
def ldap_user_include_groups
|
274
|
+
@attributes[:ldap_user_include_groups]
|
275
|
+
end
|
276
|
+
|
277
|
+
# string - Username for signing in to LDAP server.
|
278
|
+
def ldap_username
|
279
|
+
@attributes[:ldap_username]
|
280
|
+
end
|
281
|
+
|
282
|
+
# string - LDAP username field
|
283
|
+
def ldap_username_field
|
284
|
+
@attributes[:ldap_username_field]
|
285
|
+
end
|
286
|
+
|
287
|
+
# string - Login help text
|
288
|
+
def login_help_text
|
289
|
+
@attributes[:login_help_text]
|
290
|
+
end
|
291
|
+
|
292
|
+
# Branded logo
|
293
|
+
def logo
|
294
|
+
@attributes[:logo]
|
295
|
+
end
|
296
|
+
|
297
|
+
# int64 - Number of prior passwords to disallow
|
298
|
+
def max_prior_passwords
|
299
|
+
@attributes[:max_prior_passwords]
|
300
|
+
end
|
301
|
+
|
302
|
+
# double - Next billing amount
|
303
|
+
def next_billing_amount
|
304
|
+
@attributes[:next_billing_amount]
|
305
|
+
end
|
306
|
+
|
307
|
+
# string - Next billing date
|
308
|
+
def next_billing_date
|
309
|
+
@attributes[:next_billing_date]
|
310
|
+
end
|
311
|
+
|
312
|
+
# boolean - Allow users to use Office for the web?
|
313
|
+
def office_integration_available
|
314
|
+
@attributes[:office_integration_available]
|
315
|
+
end
|
316
|
+
|
317
|
+
# boolean - Use servers in the USA only?
|
318
|
+
def opt_out_global
|
319
|
+
@attributes[:opt_out_global]
|
320
|
+
end
|
321
|
+
|
322
|
+
# date-time - Last time the site was notified about an overage
|
323
|
+
def overage_notified_at
|
324
|
+
@attributes[:overage_notified_at]
|
325
|
+
end
|
326
|
+
|
327
|
+
# boolean - Notify site email of overages?
|
328
|
+
def overage_notify
|
329
|
+
@attributes[:overage_notify]
|
330
|
+
end
|
331
|
+
|
332
|
+
# boolean - Is this site's billing overdue?
|
333
|
+
def overdue
|
334
|
+
@attributes[:overdue]
|
335
|
+
end
|
336
|
+
|
337
|
+
# int64 - Shortest password length for users
|
338
|
+
def password_min_length
|
339
|
+
@attributes[:password_min_length]
|
340
|
+
end
|
341
|
+
|
342
|
+
# boolean - Require a letter in passwords?
|
343
|
+
def password_require_letter
|
344
|
+
@attributes[:password_require_letter]
|
345
|
+
end
|
346
|
+
|
347
|
+
# boolean - Require lower and upper case letters in passwords?
|
348
|
+
def password_require_mixed
|
349
|
+
@attributes[:password_require_mixed]
|
350
|
+
end
|
351
|
+
|
352
|
+
# boolean - Require a number in passwords?
|
353
|
+
def password_require_number
|
354
|
+
@attributes[:password_require_number]
|
355
|
+
end
|
356
|
+
|
357
|
+
# boolean - Require special characters in password?
|
358
|
+
def password_require_special
|
359
|
+
@attributes[:password_require_special]
|
360
|
+
end
|
361
|
+
|
362
|
+
# boolean - Require passwords that have not been previously breached? (see https://haveibeenpwned.com/)
|
363
|
+
def password_require_unbreached
|
364
|
+
@attributes[:password_require_unbreached]
|
365
|
+
end
|
366
|
+
|
367
|
+
# boolean - Require bundles' passwords, and passwords for other items (inboxes, public shares, etc.) to conform to the same requirements as users' passwords?
|
368
|
+
def password_requirements_apply_to_bundles
|
369
|
+
@attributes[:password_requirements_apply_to_bundles]
|
370
|
+
end
|
371
|
+
|
372
|
+
# int64 - Number of days password is valid
|
373
|
+
def password_validity_days
|
374
|
+
@attributes[:password_validity_days]
|
375
|
+
end
|
376
|
+
|
377
|
+
# string - Site phone number
|
378
|
+
def phone
|
379
|
+
@attributes[:phone]
|
380
|
+
end
|
381
|
+
|
382
|
+
# boolean - Require two-factor authentication for all users?
|
383
|
+
def require_2fa
|
384
|
+
@attributes[:require_2fa]
|
385
|
+
end
|
386
|
+
|
387
|
+
# date-time - If set, requirement for two-factor authentication has been scheduled to end on this date-time.
|
388
|
+
def require_2fa_stop_time
|
389
|
+
@attributes[:require_2fa_stop_time]
|
390
|
+
end
|
391
|
+
|
392
|
+
# string - What type of user is required to use two-factor authentication (when require_2fa is set to `true` for this site)?
|
393
|
+
def require_2fa_user_type
|
394
|
+
@attributes[:require_2fa_user_type]
|
395
|
+
end
|
396
|
+
|
397
|
+
# Current session
|
398
|
+
def session
|
399
|
+
@attributes[:session]
|
400
|
+
end
|
401
|
+
|
402
|
+
# boolean - Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
|
403
|
+
def session_pinned_by_ip
|
404
|
+
@attributes[:session_pinned_by_ip]
|
405
|
+
end
|
406
|
+
|
407
|
+
# boolean - Use user FTP roots also for SFTP?
|
408
|
+
def sftp_user_root_enabled
|
409
|
+
@attributes[:sftp_user_root_enabled]
|
410
|
+
end
|
411
|
+
|
412
|
+
# boolean - Allow bundle creation
|
413
|
+
def sharing_enabled
|
414
|
+
@attributes[:sharing_enabled]
|
415
|
+
end
|
416
|
+
|
417
|
+
# boolean - Show request access link for users without access? Currently unused.
|
418
|
+
def show_request_access_link
|
419
|
+
@attributes[:show_request_access_link]
|
420
|
+
end
|
421
|
+
|
422
|
+
# string - Custom site footer text
|
423
|
+
def site_footer
|
424
|
+
@attributes[:site_footer]
|
425
|
+
end
|
426
|
+
|
427
|
+
# string - Custom site header text
|
428
|
+
def site_header
|
429
|
+
@attributes[:site_header]
|
430
|
+
end
|
431
|
+
|
432
|
+
# string - SMTP server hostname or IP
|
433
|
+
def smtp_address
|
434
|
+
@attributes[:smtp_address]
|
435
|
+
end
|
436
|
+
|
437
|
+
# string - SMTP server authentication type
|
438
|
+
def smtp_authentication
|
439
|
+
@attributes[:smtp_authentication]
|
440
|
+
end
|
441
|
+
|
442
|
+
# string - From address to use when mailing through custom SMTP
|
443
|
+
def smtp_from
|
444
|
+
@attributes[:smtp_from]
|
445
|
+
end
|
446
|
+
|
447
|
+
# int64 - SMTP server port
|
448
|
+
def smtp_port
|
449
|
+
@attributes[:smtp_port]
|
450
|
+
end
|
451
|
+
|
452
|
+
# string - SMTP server username
|
453
|
+
def smtp_username
|
454
|
+
@attributes[:smtp_username]
|
455
|
+
end
|
456
|
+
|
457
|
+
# double - Session expiry in hours
|
458
|
+
def session_expiry
|
459
|
+
@attributes[:session_expiry]
|
460
|
+
end
|
461
|
+
|
462
|
+
# boolean - Is SSL required? Disabling this is insecure.
|
463
|
+
def ssl_required
|
464
|
+
@attributes[:ssl_required]
|
465
|
+
end
|
466
|
+
|
467
|
+
# string - Site subdomain
|
468
|
+
def subdomain
|
469
|
+
@attributes[:subdomain]
|
470
|
+
end
|
471
|
+
|
472
|
+
# date-time - If switching plans, when does the new plan take effect?
|
473
|
+
def switch_to_plan_date
|
474
|
+
@attributes[:switch_to_plan_date]
|
475
|
+
end
|
476
|
+
|
477
|
+
# boolean - Is TLS disabled(site setting)?
|
478
|
+
def tls_disabled
|
479
|
+
@attributes[:tls_disabled]
|
480
|
+
end
|
481
|
+
|
482
|
+
# int64 - Number of days left in trial
|
483
|
+
def trial_days_left
|
484
|
+
@attributes[:trial_days_left]
|
485
|
+
end
|
486
|
+
|
487
|
+
# date-time - When does this Site trial expire?
|
488
|
+
def trial_until
|
489
|
+
@attributes[:trial_until]
|
490
|
+
end
|
491
|
+
|
492
|
+
# date-time - Last time this Site was updated
|
493
|
+
def updated_at
|
494
|
+
@attributes[:updated_at]
|
495
|
+
end
|
496
|
+
|
497
|
+
# boolean - Allow uploaders to set `provided_modified_at` for uploaded files?
|
498
|
+
def use_provided_modified_at
|
499
|
+
@attributes[:use_provided_modified_at]
|
500
|
+
end
|
501
|
+
|
502
|
+
# User of current session
|
503
|
+
def user
|
504
|
+
@attributes[:user]
|
505
|
+
end
|
506
|
+
|
507
|
+
# boolean - Will users be locked out after incorrect login attempts?
|
508
|
+
def user_lockout
|
509
|
+
@attributes[:user_lockout]
|
510
|
+
end
|
511
|
+
|
512
|
+
# int64 - How many hours to lock user out for failed password?
|
513
|
+
def user_lockout_lock_period
|
514
|
+
@attributes[:user_lockout_lock_period]
|
515
|
+
end
|
516
|
+
|
517
|
+
# int64 - Number of login tries within `user_lockout_within` hours before users are locked out
|
518
|
+
def user_lockout_tries
|
519
|
+
@attributes[:user_lockout_tries]
|
520
|
+
end
|
521
|
+
|
522
|
+
# int64 - Number of hours for user lockout window
|
523
|
+
def user_lockout_within
|
524
|
+
@attributes[:user_lockout_within]
|
525
|
+
end
|
526
|
+
|
527
|
+
# boolean - Enable User Requests feature
|
528
|
+
def user_requests_enabled
|
529
|
+
@attributes[:user_requests_enabled]
|
530
|
+
end
|
531
|
+
|
532
|
+
# string - Custom text send in user welcome email
|
533
|
+
def welcome_custom_text
|
534
|
+
@attributes[:welcome_custom_text]
|
535
|
+
end
|
536
|
+
|
537
|
+
# email - Include this email in welcome emails if enabled
|
538
|
+
def welcome_email_cc
|
539
|
+
@attributes[:welcome_email_cc]
|
540
|
+
end
|
541
|
+
|
542
|
+
# boolean - Will the welcome email be sent to new users?
|
543
|
+
def welcome_email_enabled
|
544
|
+
@attributes[:welcome_email_enabled]
|
545
|
+
end
|
546
|
+
|
547
|
+
# string - Does the welcome screen appear?
|
548
|
+
def welcome_screen
|
549
|
+
@attributes[:welcome_screen]
|
550
|
+
end
|
551
|
+
|
552
|
+
# boolean - Does FTP user Windows emulation mode?
|
553
|
+
def windows_mode_ftp
|
554
|
+
@attributes[:windows_mode_ftp]
|
555
|
+
end
|
556
|
+
|
557
|
+
# int64 - If greater than zero, users will unable to login if they do not show activity within this number of days.
|
558
|
+
def disable_users_from_inactivity_period_days
|
559
|
+
@attributes[:disable_users_from_inactivity_period_days]
|
560
|
+
end
|
561
|
+
|
562
|
+
def self.get(params = {}, options = {})
|
563
|
+
response, options = Api.send_request("/site", :get, params, options)
|
564
|
+
Site.new(response.data, options)
|
565
|
+
end
|
566
|
+
|
567
|
+
def self.get_usage(params = {}, options = {})
|
568
|
+
response, options = Api.send_request("/site/usage", :get, params, options)
|
569
|
+
UsageSnapshot.new(response.data, options)
|
570
|
+
end
|
571
|
+
|
572
|
+
# Parameters:
|
573
|
+
# name - string - Site name
|
574
|
+
# subdomain - string - Site subdomain
|
575
|
+
# domain - string - Custom domain
|
576
|
+
# email - string - Main email for this site
|
577
|
+
# allow_bundle_names - boolean - Are manual Bundle names allowed?
|
578
|
+
# bundle_expiration - int64 - Site-wide Bundle expiration in days
|
579
|
+
# overage_notify - boolean - Notify site email of overages?
|
580
|
+
# welcome_email_enabled - boolean - Will the welcome email be sent to new users?
|
581
|
+
# ask_about_overwrites - boolean - If false, rename conflicting files instead of asking for overwrite confirmation. Only applies to web interface.
|
582
|
+
# show_request_access_link - boolean - Show request access link for users without access? Currently unused.
|
583
|
+
# welcome_email_cc - string - Include this email in welcome emails if enabled
|
584
|
+
# welcome_custom_text - string - Custom text send in user welcome email
|
585
|
+
# language - string - Site default language
|
586
|
+
# windows_mode_ftp - boolean - Does FTP user Windows emulation mode?
|
587
|
+
# default_time_zone - string - Site default time zone
|
588
|
+
# desktop_app - boolean - Is the desktop app enabled?
|
589
|
+
# desktop_app_session_ip_pinning - boolean - Is desktop app session IP pinning enabled?
|
590
|
+
# desktop_app_session_lifetime - int64 - Desktop app session lifetime (in hours)
|
591
|
+
# folder_permissions_groups_only - boolean - If true, permissions for this site must be bound to a group (not a user). Otherwise, permissions must be bound to a user.
|
592
|
+
# welcome_screen - string - Does the welcome screen appear?
|
593
|
+
# office_integration_available - boolean - Allow users to use Office for the web?
|
594
|
+
# session_expiry - double - Session expiry in hours
|
595
|
+
# ssl_required - boolean - Is SSL required? Disabling this is insecure.
|
596
|
+
# tls_disabled - boolean - Is TLS disabled(site setting)?
|
597
|
+
# user_lockout - boolean - Will users be locked out after incorrect login attempts?
|
598
|
+
# user_lockout_tries - int64 - Number of login tries within `user_lockout_within` hours before users are locked out
|
599
|
+
# user_lockout_within - int64 - Number of hours for user lockout window
|
600
|
+
# user_lockout_lock_period - int64 - How many hours to lock user out for failed password?
|
601
|
+
# include_password_in_welcome_email - boolean - Include password in emails to new users?
|
602
|
+
# allowed_ips - string - List of allowed IP addresses
|
603
|
+
# days_to_retain_backups - int64 - Number of days to keep deleted files
|
604
|
+
# max_prior_passwords - int64 - Number of prior passwords to disallow
|
605
|
+
# password_validity_days - int64 - Number of days password is valid
|
606
|
+
# password_min_length - int64 - Shortest password length for users
|
607
|
+
# password_require_letter - boolean - Require a letter in passwords?
|
608
|
+
# password_require_mixed - boolean - Require lower and upper case letters in passwords?
|
609
|
+
# password_require_special - boolean - Require special characters in password?
|
610
|
+
# password_require_number - boolean - Require a number in passwords?
|
611
|
+
# password_require_unbreached - boolean - Require passwords that have not been previously breached? (see https://haveibeenpwned.com/)
|
612
|
+
# sftp_user_root_enabled - boolean - Use user FTP roots also for SFTP?
|
613
|
+
# disable_password_reset - boolean - Is password reset disabled?
|
614
|
+
# immutable_files - boolean - Are files protected from modification?
|
615
|
+
# session_pinned_by_ip - boolean - Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
|
616
|
+
# bundle_password_required - boolean - Do Bundles require password protection?
|
617
|
+
# password_requirements_apply_to_bundles - boolean - Require bundles' passwords, and passwords for other items (inboxes, public shares, etc.) to conform to the same requirements as users' passwords?
|
618
|
+
# opt_out_global - boolean - Use servers in the USA only?
|
619
|
+
# use_provided_modified_at - boolean - Allow uploaders to set `provided_modified_at` for uploaded files?
|
620
|
+
# custom_namespace - boolean - Is this site using a custom namespace for users?
|
621
|
+
# disable_users_from_inactivity_period_days - int64 - If greater than zero, users will unable to login if they do not show activity within this number of days.
|
622
|
+
# non_sso_groups_allowed - boolean - If true, groups can be manually created / modified / deleted by Site Admins. Otherwise, groups can only be managed via your SSO provider.
|
623
|
+
# non_sso_users_allowed - boolean - If true, users can be manually created / modified / deleted by Site Admins. Otherwise, users can only be managed via your SSO provider.
|
624
|
+
# sharing_enabled - boolean - Allow bundle creation
|
625
|
+
# user_requests_enabled - boolean - Enable User Requests feature
|
626
|
+
# allowed_2fa_method_sms - boolean - Is SMS two factor authentication allowed?
|
627
|
+
# allowed_2fa_method_u2f - boolean - Is U2F two factor authentication allowed?
|
628
|
+
# allowed_2fa_method_totp - boolean - Is TOTP two factor authentication allowed?
|
629
|
+
# allowed_2fa_method_yubi - boolean - Is yubikey two factor authentication allowed?
|
630
|
+
# require_2fa - boolean - Require two-factor authentication for all users?
|
631
|
+
# require_2fa_user_type - string - What type of user is required to use two-factor authentication (when require_2fa is set to `true` for this site)?
|
632
|
+
# color2_top - string - Top bar background color
|
633
|
+
# color2_left - string - Page link and button color
|
634
|
+
# color2_link - string - Top bar link color
|
635
|
+
# color2_text - string - Page link and button color
|
636
|
+
# color2_top_text - string - Top bar text color
|
637
|
+
# site_header - string - Custom site header text
|
638
|
+
# site_footer - string - Custom site footer text
|
639
|
+
# login_help_text - string - Login help text
|
640
|
+
# smtp_address - string - SMTP server hostname or IP
|
641
|
+
# smtp_authentication - string - SMTP server authentication type
|
642
|
+
# smtp_from - string - From address to use when mailing through custom SMTP
|
643
|
+
# smtp_username - string - SMTP server username
|
644
|
+
# smtp_port - int64 - SMTP server port
|
645
|
+
# ldap_enabled - boolean - Main LDAP setting: is LDAP enabled?
|
646
|
+
# ldap_type - string - LDAP type
|
647
|
+
# ldap_host - string - LDAP host
|
648
|
+
# ldap_host_2 - string - LDAP backup host
|
649
|
+
# ldap_host_3 - string - LDAP backup host
|
650
|
+
# ldap_port - int64 - LDAP port
|
651
|
+
# ldap_secure - boolean - Use secure LDAP?
|
652
|
+
# ldap_username - string - Username for signing in to LDAP server.
|
653
|
+
# ldap_username_field - string - LDAP username field
|
654
|
+
# ldap_domain - string - Domain name that will be appended to usernames
|
655
|
+
# ldap_user_action - string - Should we sync users from LDAP server?
|
656
|
+
# ldap_group_action - string - Should we sync groups from LDAP server?
|
657
|
+
# ldap_user_include_groups - string - Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
|
658
|
+
# ldap_group_exclusion - string - Comma or newline separated list of group names (with optional wildcards) to exclude when syncing.
|
659
|
+
# ldap_group_inclusion - string - Comma or newline separated list of group names (with optional wildcards) to include when syncing.
|
660
|
+
# ldap_base_dn - string - Base DN for looking up users in LDAP server
|
661
|
+
# icon16_file - file
|
662
|
+
# icon16_delete - boolean - If true, will delete the file stored in icon16
|
663
|
+
# icon32_file - file
|
664
|
+
# icon32_delete - boolean - If true, will delete the file stored in icon32
|
665
|
+
# icon48_file - file
|
666
|
+
# icon48_delete - boolean - If true, will delete the file stored in icon48
|
667
|
+
# icon128_file - file
|
668
|
+
# icon128_delete - boolean - If true, will delete the file stored in icon128
|
669
|
+
# logo_file - file
|
670
|
+
# logo_delete - boolean - If true, will delete the file stored in logo
|
671
|
+
# disable_2fa_with_delay - boolean - If set to true, we will begin the process of disabling 2FA on this site.
|
672
|
+
# ldap_password_change - string - New LDAP password.
|
673
|
+
# ldap_password_change_confirmation - string - Confirm new LDAP password.
|
674
|
+
# smtp_password - string - Password for SMTP server.
|
675
|
+
def self.update(params = {}, options = {})
|
676
|
+
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
677
|
+
raise InvalidParameterError.new("Bad parameter: subdomain must be an String") if params.dig(:subdomain) and !params.dig(:subdomain).is_a?(String)
|
678
|
+
raise InvalidParameterError.new("Bad parameter: domain must be an String") if params.dig(:domain) and !params.dig(:domain).is_a?(String)
|
679
|
+
raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
|
680
|
+
raise InvalidParameterError.new("Bad parameter: bundle_expiration must be an Integer") if params.dig(:bundle_expiration) and !params.dig(:bundle_expiration).is_a?(Integer)
|
681
|
+
raise InvalidParameterError.new("Bad parameter: welcome_email_cc must be an String") if params.dig(:welcome_email_cc) and !params.dig(:welcome_email_cc).is_a?(String)
|
682
|
+
raise InvalidParameterError.new("Bad parameter: welcome_custom_text must be an String") if params.dig(:welcome_custom_text) and !params.dig(:welcome_custom_text).is_a?(String)
|
683
|
+
raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
|
684
|
+
raise InvalidParameterError.new("Bad parameter: default_time_zone must be an String") if params.dig(:default_time_zone) and !params.dig(:default_time_zone).is_a?(String)
|
685
|
+
raise InvalidParameterError.new("Bad parameter: desktop_app_session_lifetime must be an Integer") if params.dig(:desktop_app_session_lifetime) and !params.dig(:desktop_app_session_lifetime).is_a?(Integer)
|
686
|
+
raise InvalidParameterError.new("Bad parameter: welcome_screen must be an String") if params.dig(:welcome_screen) and !params.dig(:welcome_screen).is_a?(String)
|
687
|
+
raise InvalidParameterError.new("Bad parameter: session_expiry must be an Float") if params.dig(:session_expiry) and !params.dig(:session_expiry).is_a?(Float)
|
688
|
+
raise InvalidParameterError.new("Bad parameter: user_lockout_tries must be an Integer") if params.dig(:user_lockout_tries) and !params.dig(:user_lockout_tries).is_a?(Integer)
|
689
|
+
raise InvalidParameterError.new("Bad parameter: user_lockout_within must be an Integer") if params.dig(:user_lockout_within) and !params.dig(:user_lockout_within).is_a?(Integer)
|
690
|
+
raise InvalidParameterError.new("Bad parameter: user_lockout_lock_period must be an Integer") if params.dig(:user_lockout_lock_period) and !params.dig(:user_lockout_lock_period).is_a?(Integer)
|
691
|
+
raise InvalidParameterError.new("Bad parameter: allowed_ips must be an String") if params.dig(:allowed_ips) and !params.dig(:allowed_ips).is_a?(String)
|
692
|
+
raise InvalidParameterError.new("Bad parameter: days_to_retain_backups must be an Integer") if params.dig(:days_to_retain_backups) and !params.dig(:days_to_retain_backups).is_a?(Integer)
|
693
|
+
raise InvalidParameterError.new("Bad parameter: max_prior_passwords must be an Integer") if params.dig(:max_prior_passwords) and !params.dig(:max_prior_passwords).is_a?(Integer)
|
694
|
+
raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
|
695
|
+
raise InvalidParameterError.new("Bad parameter: password_min_length must be an Integer") if params.dig(:password_min_length) and !params.dig(:password_min_length).is_a?(Integer)
|
696
|
+
raise InvalidParameterError.new("Bad parameter: disable_users_from_inactivity_period_days must be an Integer") if params.dig(:disable_users_from_inactivity_period_days) and !params.dig(:disable_users_from_inactivity_period_days).is_a?(Integer)
|
697
|
+
raise InvalidParameterError.new("Bad parameter: require_2fa_user_type must be an String") if params.dig(:require_2fa_user_type) and !params.dig(:require_2fa_user_type).is_a?(String)
|
698
|
+
raise InvalidParameterError.new("Bad parameter: color2_top must be an String") if params.dig(:color2_top) and !params.dig(:color2_top).is_a?(String)
|
699
|
+
raise InvalidParameterError.new("Bad parameter: color2_left must be an String") if params.dig(:color2_left) and !params.dig(:color2_left).is_a?(String)
|
700
|
+
raise InvalidParameterError.new("Bad parameter: color2_link must be an String") if params.dig(:color2_link) and !params.dig(:color2_link).is_a?(String)
|
701
|
+
raise InvalidParameterError.new("Bad parameter: color2_text must be an String") if params.dig(:color2_text) and !params.dig(:color2_text).is_a?(String)
|
702
|
+
raise InvalidParameterError.new("Bad parameter: color2_top_text must be an String") if params.dig(:color2_top_text) and !params.dig(:color2_top_text).is_a?(String)
|
703
|
+
raise InvalidParameterError.new("Bad parameter: site_header must be an String") if params.dig(:site_header) and !params.dig(:site_header).is_a?(String)
|
704
|
+
raise InvalidParameterError.new("Bad parameter: site_footer must be an String") if params.dig(:site_footer) and !params.dig(:site_footer).is_a?(String)
|
705
|
+
raise InvalidParameterError.new("Bad parameter: login_help_text must be an String") if params.dig(:login_help_text) and !params.dig(:login_help_text).is_a?(String)
|
706
|
+
raise InvalidParameterError.new("Bad parameter: smtp_address must be an String") if params.dig(:smtp_address) and !params.dig(:smtp_address).is_a?(String)
|
707
|
+
raise InvalidParameterError.new("Bad parameter: smtp_authentication must be an String") if params.dig(:smtp_authentication) and !params.dig(:smtp_authentication).is_a?(String)
|
708
|
+
raise InvalidParameterError.new("Bad parameter: smtp_from must be an String") if params.dig(:smtp_from) and !params.dig(:smtp_from).is_a?(String)
|
709
|
+
raise InvalidParameterError.new("Bad parameter: smtp_username must be an String") if params.dig(:smtp_username) and !params.dig(:smtp_username).is_a?(String)
|
710
|
+
raise InvalidParameterError.new("Bad parameter: smtp_port must be an Integer") if params.dig(:smtp_port) and !params.dig(:smtp_port).is_a?(Integer)
|
711
|
+
raise InvalidParameterError.new("Bad parameter: ldap_type must be an String") if params.dig(:ldap_type) and !params.dig(:ldap_type).is_a?(String)
|
712
|
+
raise InvalidParameterError.new("Bad parameter: ldap_host must be an String") if params.dig(:ldap_host) and !params.dig(:ldap_host).is_a?(String)
|
713
|
+
raise InvalidParameterError.new("Bad parameter: ldap_host_2 must be an String") if params.dig(:ldap_host_2) and !params.dig(:ldap_host_2).is_a?(String)
|
714
|
+
raise InvalidParameterError.new("Bad parameter: ldap_host_3 must be an String") if params.dig(:ldap_host_3) and !params.dig(:ldap_host_3).is_a?(String)
|
715
|
+
raise InvalidParameterError.new("Bad parameter: ldap_port must be an Integer") if params.dig(:ldap_port) and !params.dig(:ldap_port).is_a?(Integer)
|
716
|
+
raise InvalidParameterError.new("Bad parameter: ldap_username must be an String") if params.dig(:ldap_username) and !params.dig(:ldap_username).is_a?(String)
|
717
|
+
raise InvalidParameterError.new("Bad parameter: ldap_username_field must be an String") if params.dig(:ldap_username_field) and !params.dig(:ldap_username_field).is_a?(String)
|
718
|
+
raise InvalidParameterError.new("Bad parameter: ldap_domain must be an String") if params.dig(:ldap_domain) and !params.dig(:ldap_domain).is_a?(String)
|
719
|
+
raise InvalidParameterError.new("Bad parameter: ldap_user_action must be an String") if params.dig(:ldap_user_action) and !params.dig(:ldap_user_action).is_a?(String)
|
720
|
+
raise InvalidParameterError.new("Bad parameter: ldap_group_action must be an String") if params.dig(:ldap_group_action) and !params.dig(:ldap_group_action).is_a?(String)
|
721
|
+
raise InvalidParameterError.new("Bad parameter: ldap_user_include_groups must be an String") if params.dig(:ldap_user_include_groups) and !params.dig(:ldap_user_include_groups).is_a?(String)
|
722
|
+
raise InvalidParameterError.new("Bad parameter: ldap_group_exclusion must be an String") if params.dig(:ldap_group_exclusion) and !params.dig(:ldap_group_exclusion).is_a?(String)
|
723
|
+
raise InvalidParameterError.new("Bad parameter: ldap_group_inclusion must be an String") if params.dig(:ldap_group_inclusion) and !params.dig(:ldap_group_inclusion).is_a?(String)
|
724
|
+
raise InvalidParameterError.new("Bad parameter: ldap_base_dn must be an String") if params.dig(:ldap_base_dn) and !params.dig(:ldap_base_dn).is_a?(String)
|
725
|
+
raise InvalidParameterError.new("Bad parameter: ldap_password_change must be an String") if params.dig(:ldap_password_change) and !params.dig(:ldap_password_change).is_a?(String)
|
726
|
+
raise InvalidParameterError.new("Bad parameter: ldap_password_change_confirmation must be an String") if params.dig(:ldap_password_change_confirmation) and !params.dig(:ldap_password_change_confirmation).is_a?(String)
|
727
|
+
raise InvalidParameterError.new("Bad parameter: smtp_password must be an String") if params.dig(:smtp_password) and !params.dig(:smtp_password).is_a?(String)
|
728
|
+
|
729
|
+
response, options = Api.send_request("/site", :patch, params, options)
|
730
|
+
Site.new(response.data, options)
|
731
|
+
end
|
732
|
+
end
|
733
|
+
end
|