kaltura-client 18.15.0 → 18.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +1 -1
- data/lib/kaltura_client.rb +2 -2
- data/lib/kaltura_client_base.rb +63 -0
- data/lib/kaltura_enums.rb +2 -0
- data/lib/kaltura_plugins/kaltura_audit_client_plugin.rb +1 -0
- data/lib/kaltura_plugins/kaltura_drop_folder_client_plugin.rb +1 -1
- data/lib/kaltura_types.rb +21 -0
- data/test/configuration_test.rb +8 -8
- data/test/test_helper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b959a733b1f4008544662b41833814f5f29e4faae68825ad5ef5fd4310e7ce
|
4
|
+
data.tar.gz: c89ca7c196c4c54e138885ff0aa611558e5630126c39f18294f33def9b9ad7c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6aafaa8e5f69c33dbaf29648d682d63d66ac99e0cdb960390f5e6384d249403a456b2d0cdf3f13a7d42d834ab9268cbdbe61ecde5db41b460414e55cc658514
|
7
|
+
data.tar.gz: bff415412057af8714b23449b51211a96460e6d9a0b80f02409c5cb4f607611b97777e1bfec6c3e07c92ed424f8330478a106545adbe2d09da88ba7cea3dc399
|
data/README
CHANGED
data/lib/kaltura_client.rb
CHANGED
@@ -6382,8 +6382,8 @@ module Kaltura
|
|
6382
6382
|
|
6383
6383
|
def initialize(client)
|
6384
6384
|
super(client)
|
6385
|
-
self.client_tag = 'ruby:22-
|
6386
|
-
self.api_version = '18.
|
6385
|
+
self.client_tag = 'ruby:22-11-08'
|
6386
|
+
self.api_version = '18.17.0'
|
6387
6387
|
end
|
6388
6388
|
|
6389
6389
|
def client_tag=(value)
|
data/lib/kaltura_client_base.rb
CHANGED
@@ -36,11 +36,18 @@ require 'digest/sha1'
|
|
36
36
|
require 'base64'
|
37
37
|
require 'date'
|
38
38
|
require 'yaml'
|
39
|
+
require 'uri'
|
39
40
|
|
40
41
|
module Kaltura
|
41
42
|
class KalturaNotImplemented; end
|
42
43
|
|
43
44
|
class KalturaClientBase
|
45
|
+
|
46
|
+
# KS V2 constants
|
47
|
+
FIELD_EXPIRY = '_e';
|
48
|
+
FIELD_TYPE = '_t';
|
49
|
+
FIELD_USER = '_u';
|
50
|
+
|
44
51
|
attr_accessor :config
|
45
52
|
attr_reader :is_multirequest
|
46
53
|
attr_reader :responseHeaders
|
@@ -387,6 +394,62 @@ module Kaltura
|
|
387
394
|
|
388
395
|
self.ks = cleaned
|
389
396
|
end
|
397
|
+
|
398
|
+
def generate_session_v2(admin_secret, user_id, kaltura_session_type, partner_id, expiry=86400, privileges=nil)
|
399
|
+
fields = {}
|
400
|
+
if privileges !=nil
|
401
|
+
privileges.split(',').each do |privilege|
|
402
|
+
privilege.strip!
|
403
|
+
if !privilege
|
404
|
+
next
|
405
|
+
end
|
406
|
+
if (privilege == '*')
|
407
|
+
privilege = 'all:*'
|
408
|
+
end
|
409
|
+
splitted_privilege = privilege.split(':', 2)
|
410
|
+
if (splitted_privilege.count > 1)
|
411
|
+
fields[splitted_privilege[0]] = splitted_privilege[1]
|
412
|
+
else
|
413
|
+
fields[splitted_privilege[0]] = ''
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
fields[KalturaClientBase::FIELD_EXPIRY] = (Time.now.to_i + expiry.to_i)
|
418
|
+
fields[KalturaClientBase::FIELD_TYPE] = kaltura_session_type
|
419
|
+
fields[KalturaClientBase::FIELD_USER] = user_id
|
420
|
+
|
421
|
+
# build fields string
|
422
|
+
fields_str = URI.encode_www_form(fields)
|
423
|
+
rand = ''
|
424
|
+
for i in 0..15 do
|
425
|
+
rand += rand(0..0xff).chr
|
426
|
+
end
|
427
|
+
fields_str = rand + fields_str
|
428
|
+
fields_str = Digest::SHA1.digest(fields_str) + fields_str
|
429
|
+
|
430
|
+
# encrypt and encode
|
431
|
+
encrypted_fields = aes_encrypt(admin_secret, fields_str)
|
432
|
+
decoded_ks = "v2|#{partner_id}|" + encrypted_fields
|
433
|
+
# in other clients, we do not set the ks on the client object here, only return it; however, because
|
434
|
+
# this was done in generate_session(), I added it for compatibility reasons.
|
435
|
+
self.ks = Base64.urlsafe_encode64(decoded_ks).gsub('+','-').gsub('/','_')
|
436
|
+
return self.ks
|
437
|
+
end
|
438
|
+
|
439
|
+
def aes_encrypt(key, data)
|
440
|
+
iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" # no need for an IV since we add a random string to the message anyway
|
441
|
+
key = Digest::SHA1.digest(key)[0..15]
|
442
|
+
cipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
443
|
+
cipher.encrypt
|
444
|
+
|
445
|
+
cipher.padding = 0 # we must disable native padding.
|
446
|
+
cipher.key = key
|
447
|
+
cipher.iv = iv
|
448
|
+
block_size = cipher.block_size
|
449
|
+
# this is needed to maintain compatibility with the legacy mcrypt extension, see https://github.com/kaltura/server/blob/Rigel-18.16.0/infra/general/KCryptoWrapper.class.php#L79
|
450
|
+
data = data + "\0" * (block_size - data.bytesize % block_size)
|
451
|
+
return cipher.update(data) + cipher.final
|
452
|
+
end
|
390
453
|
end
|
391
454
|
|
392
455
|
class KalturaServiceActionCall
|
data/lib/kaltura_enums.rb
CHANGED
@@ -3874,6 +3874,8 @@ module Kaltura
|
|
3874
3874
|
end
|
3875
3875
|
|
3876
3876
|
class KalturaUserEntryExtendedStatus
|
3877
|
+
SYNC_STATUS_ERROR = "quiz.SYNC_STATUS_ERROR"
|
3878
|
+
SYNC_STATUS_SUCCESS = "quiz.SYNC_STATUS_SUCCESS"
|
3877
3879
|
PLAYBACK_COMPLETE = "viewHistory.PLAYBACK_COMPLETE"
|
3878
3880
|
PLAYBACK_STARTED = "viewHistory.PLAYBACK_STARTED"
|
3879
3881
|
VIEWED = "viewHistory.VIEWED"
|
@@ -224,7 +224,7 @@ module Kaltura
|
|
224
224
|
attr_accessor :conversion_profile_id
|
225
225
|
attr_accessor :dc
|
226
226
|
attr_accessor :path
|
227
|
-
# The
|
227
|
+
# The amount of time, in seconds, that should pass so that a file with no change in size will be treated as "finished uploading to folder"
|
228
228
|
attr_accessor :file_size_check_interval
|
229
229
|
attr_accessor :file_delete_policy
|
230
230
|
attr_accessor :file_delete_regex
|
data/lib/kaltura_types.rb
CHANGED
@@ -2016,11 +2016,13 @@ module Kaltura
|
|
2016
2016
|
attr_accessor :max_login_attempts
|
2017
2017
|
attr_accessor :login_block_period
|
2018
2018
|
attr_accessor :num_prev_pass_to_keep
|
2019
|
+
attr_accessor :allow_default_password_restrictions
|
2019
2020
|
attr_accessor :two_factor_authentication_mode
|
2020
2021
|
attr_accessor :is_self_serve
|
2021
2022
|
attr_accessor :allowed_domains
|
2022
2023
|
attr_accessor :excluded_admin_role_name
|
2023
2024
|
attr_accessor :event_platform_allowed_templates
|
2025
|
+
attr_accessor :vertical_classification_id
|
2024
2026
|
|
2025
2027
|
def id=(val)
|
2026
2028
|
@id = val.to_i
|
@@ -2130,12 +2132,18 @@ module Kaltura
|
|
2130
2132
|
def num_prev_pass_to_keep=(val)
|
2131
2133
|
@num_prev_pass_to_keep = val.to_i
|
2132
2134
|
end
|
2135
|
+
def allow_default_password_restrictions=(val)
|
2136
|
+
@allow_default_password_restrictions = to_b(val)
|
2137
|
+
end
|
2133
2138
|
def two_factor_authentication_mode=(val)
|
2134
2139
|
@two_factor_authentication_mode = val.to_i
|
2135
2140
|
end
|
2136
2141
|
def is_self_serve=(val)
|
2137
2142
|
@is_self_serve = to_b(val)
|
2138
2143
|
end
|
2144
|
+
def vertical_classification_id=(val)
|
2145
|
+
@vertical_classification_id = val.to_i
|
2146
|
+
end
|
2139
2147
|
|
2140
2148
|
def from_xml(xml_element)
|
2141
2149
|
super
|
@@ -2361,6 +2369,9 @@ module Kaltura
|
|
2361
2369
|
if xml_element.elements['numPrevPassToKeep'] != nil
|
2362
2370
|
self.num_prev_pass_to_keep = xml_element.elements['numPrevPassToKeep'].text
|
2363
2371
|
end
|
2372
|
+
if xml_element.elements['allowDefaultPasswordRestrictions'] != nil
|
2373
|
+
self.allow_default_password_restrictions = xml_element.elements['allowDefaultPasswordRestrictions'].text
|
2374
|
+
end
|
2364
2375
|
if xml_element.elements['twoFactorAuthenticationMode'] != nil
|
2365
2376
|
self.two_factor_authentication_mode = xml_element.elements['twoFactorAuthenticationMode'].text
|
2366
2377
|
end
|
@@ -2376,6 +2387,9 @@ module Kaltura
|
|
2376
2387
|
if xml_element.elements['eventPlatformAllowedTemplates'] != nil
|
2377
2388
|
self.event_platform_allowed_templates = xml_element.elements['eventPlatformAllowedTemplates'].text
|
2378
2389
|
end
|
2390
|
+
if xml_element.elements['verticalClassificationId'] != nil
|
2391
|
+
self.vertical_classification_id = xml_element.elements['verticalClassificationId'].text
|
2392
|
+
end
|
2379
2393
|
end
|
2380
2394
|
|
2381
2395
|
end
|
@@ -14164,6 +14178,7 @@ module Kaltura
|
|
14164
14178
|
attr_accessor :recording_info
|
14165
14179
|
attr_accessor :is_playable_user
|
14166
14180
|
attr_accessor :view_mode
|
14181
|
+
attr_accessor :features_updated_at
|
14167
14182
|
|
14168
14183
|
def is_playable_user=(val)
|
14169
14184
|
@is_playable_user = to_b(val)
|
@@ -14171,6 +14186,9 @@ module Kaltura
|
|
14171
14186
|
def view_mode=(val)
|
14172
14187
|
@view_mode = val.to_i
|
14173
14188
|
end
|
14189
|
+
def features_updated_at=(val)
|
14190
|
+
@features_updated_at = val.to_i
|
14191
|
+
end
|
14174
14192
|
|
14175
14193
|
def from_xml(xml_element)
|
14176
14194
|
super
|
@@ -14186,6 +14204,9 @@ module Kaltura
|
|
14186
14204
|
if xml_element.elements['viewMode'] != nil
|
14187
14205
|
self.view_mode = xml_element.elements['viewMode'].text
|
14188
14206
|
end
|
14207
|
+
if xml_element.elements['featuresUpdatedAt'] != nil
|
14208
|
+
self.features_updated_at = xml_element.elements['featuresUpdatedAt'].text
|
14209
|
+
end
|
14189
14210
|
end
|
14190
14211
|
|
14191
14212
|
end
|
data/test/configuration_test.rb
CHANGED
@@ -64,10 +64,10 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
64
64
|
config.logger = Logger.new(STDOUT)
|
65
65
|
config.timeout = timeout
|
66
66
|
|
67
|
-
@client = Kaltura::KalturaClient.new(
|
67
|
+
@client = Kaltura::KalturaClient.new(config)
|
68
68
|
assert_equal @client.ks, Kaltura::KalturaNotImplemented
|
69
69
|
|
70
|
-
session = @client.
|
70
|
+
session = @client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
|
71
71
|
@client.ks = session
|
72
72
|
|
73
73
|
assert_not_nil @client.ks
|
@@ -86,10 +86,10 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
86
86
|
config.service_url = service_url
|
87
87
|
config.logger = Logger.new(STDOUT)
|
88
88
|
|
89
|
-
@client = Kaltura::KalturaClient.new(
|
89
|
+
@client = Kaltura::KalturaClient.new(config)
|
90
90
|
|
91
91
|
assert_raise Kaltura::KalturaAPIError do
|
92
|
-
session = @client.session_service.start(
|
92
|
+
session = @client.session_service.start(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -105,10 +105,10 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
105
105
|
config.service_url = service_url
|
106
106
|
config.logger = Logger.new(STDOUT)
|
107
107
|
|
108
|
-
@client = Kaltura::KalturaClient.new(
|
108
|
+
@client = Kaltura::KalturaClient.new(config)
|
109
109
|
|
110
110
|
assert_raise Kaltura::KalturaAPIError do
|
111
|
-
session = @client.session_service.start(
|
111
|
+
session = @client.session_service.start("invalid_administrator_secret", '', Kaltura::KalturaSessionType::ADMIN, partner_id)
|
112
112
|
@client.ks = session
|
113
113
|
end
|
114
114
|
|
@@ -130,11 +130,11 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
130
130
|
config.logger = Logger.new(STDOUT)
|
131
131
|
config.timeout = timeout
|
132
132
|
|
133
|
-
@client = Kaltura::KalturaClient.new(
|
133
|
+
@client = Kaltura::KalturaClient.new(config)
|
134
134
|
|
135
135
|
assert_equal @client.ks, Kaltura::KalturaNotImplemented
|
136
136
|
|
137
|
-
@client.
|
137
|
+
@client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
|
138
138
|
|
139
139
|
assert_not_nil @client.ks
|
140
140
|
|
data/test/test_helper.rb
CHANGED
@@ -54,8 +54,8 @@ class Test::Unit::TestCase
|
|
54
54
|
config.logger = Logger.new(STDOUT)
|
55
55
|
config.timeout = timeout
|
56
56
|
|
57
|
-
@client = Kaltura::KalturaClient.new(
|
58
|
-
@client.
|
57
|
+
@client = Kaltura::KalturaClient.new(config)
|
58
|
+
@client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|