gitlab-license 1.3.1 → 2.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/lib/gitlab/license/version.rb +1 -1
- data/lib/gitlab/license.rb +59 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f9153bcc9df80fb7bcc879d15ae1e21709cec7a352ffd5c0c4de2ae082473d6
|
4
|
+
data.tar.gz: a36810ea464918c2f25bb40ebfe877b8561131bebfbf1e0d9530f1270f5f2816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37464c9ce48c030aebf3ca982bc2d4831367e0169e09c76d58e152124d6ed63202dd284e63b13c86f6eb7651cc0692db8685cc29a9bf44409167a45ce3cf722
|
7
|
+
data.tar.gz: 935474c12b21840724ae4ed064f6db461777751dae4d7454917b9ada0b93eb80138f4d678ba3b48efb6ed946da38aa11422adf5a4eadef024d3981102ec5b2cf
|
data/lib/gitlab/license.rb
CHANGED
@@ -51,8 +51,10 @@ module Gitlab
|
|
51
51
|
|
52
52
|
attr_reader :version
|
53
53
|
attr_accessor :licensee, :starts_at, :expires_at, :notify_admins_at,
|
54
|
-
:notify_users_at, :block_changes_at, :
|
55
|
-
:
|
54
|
+
:notify_users_at, :block_changes_at, :last_synced_at, :next_sync_at,
|
55
|
+
:activated_at, :restrictions, :cloud_licensing_enabled,
|
56
|
+
:offline_cloud_licensing_enabled, :auto_renew_enabled, :seat_reconciliation_enabled,
|
57
|
+
:operational_metrics_enabled, :generated_from_customers_dot
|
56
58
|
|
57
59
|
alias_method :issued_at, :starts_at
|
58
60
|
alias_method :issued_at=, :starts_at=
|
@@ -78,10 +80,12 @@ module Gitlab
|
|
78
80
|
false
|
79
81
|
elsif next_sync_at && !next_sync_at.is_a?(DateTime)
|
80
82
|
false
|
81
|
-
elsif
|
83
|
+
elsif activated_at && !activated_at.is_a?(DateTime)
|
82
84
|
false
|
83
85
|
elsif restrictions && !restrictions.is_a?(Hash)
|
84
86
|
false
|
87
|
+
elsif !cloud_licensing? && offline_cloud_licensing?
|
88
|
+
false
|
85
89
|
else
|
86
90
|
true
|
87
91
|
end
|
@@ -111,6 +115,10 @@ module Gitlab
|
|
111
115
|
next_sync_at
|
112
116
|
end
|
113
117
|
|
118
|
+
def activated?
|
119
|
+
activated_at
|
120
|
+
end
|
121
|
+
|
114
122
|
def expired?
|
115
123
|
will_expire? && Date.today >= expires_at
|
116
124
|
end
|
@@ -127,6 +135,30 @@ module Gitlab
|
|
127
135
|
will_block_changes? && Date.today >= block_changes_at
|
128
136
|
end
|
129
137
|
|
138
|
+
def cloud_licensing?
|
139
|
+
cloud_licensing_enabled == true
|
140
|
+
end
|
141
|
+
|
142
|
+
def offline_cloud_licensing?
|
143
|
+
offline_cloud_licensing_enabled == true
|
144
|
+
end
|
145
|
+
|
146
|
+
def auto_renew?
|
147
|
+
auto_renew_enabled == true
|
148
|
+
end
|
149
|
+
|
150
|
+
def seat_reconciliation?
|
151
|
+
seat_reconciliation_enabled == true
|
152
|
+
end
|
153
|
+
|
154
|
+
def operational_metrics?
|
155
|
+
operational_metrics_enabled == true
|
156
|
+
end
|
157
|
+
|
158
|
+
def generated_from_customers_dot?
|
159
|
+
generated_from_customers_dot == true
|
160
|
+
end
|
161
|
+
|
130
162
|
def restricted?(key = nil)
|
131
163
|
if key
|
132
164
|
restricted? && restrictions.has_key?(key)
|
@@ -152,7 +184,15 @@ module Gitlab
|
|
152
184
|
|
153
185
|
hash['next_sync_at'] = next_sync_at if will_sync?
|
154
186
|
hash['last_synced_at'] = last_synced_at if will_sync?
|
155
|
-
hash['
|
187
|
+
hash['activated_at'] = activated_at if activated?
|
188
|
+
|
189
|
+
hash['cloud_licensing_enabled'] = cloud_licensing?
|
190
|
+
hash['offline_cloud_licensing_enabled'] = offline_cloud_licensing?
|
191
|
+
hash['auto_renew_enabled'] = auto_renew?
|
192
|
+
hash['seat_reconciliation_enabled'] = seat_reconciliation?
|
193
|
+
hash['operational_metrics_enabled'] = operational_metrics?
|
194
|
+
|
195
|
+
hash['generated_from_customers_dot'] = generated_from_customers_dot?
|
156
196
|
|
157
197
|
hash['restrictions'] = restrictions if restricted?
|
158
198
|
|
@@ -176,7 +216,7 @@ module Gitlab
|
|
176
216
|
private
|
177
217
|
|
178
218
|
def load_attributes(attributes)
|
179
|
-
attributes =
|
219
|
+
attributes = attributes.transform_keys(&:to_s)
|
180
220
|
|
181
221
|
version = attributes['version'] || 1
|
182
222
|
raise ArgumentError, 'Version is too new' unless version && version == 1
|
@@ -184,7 +224,6 @@ module Gitlab
|
|
184
224
|
@version = version
|
185
225
|
|
186
226
|
@licensee = attributes['licensee']
|
187
|
-
@type = attributes['type']
|
188
227
|
|
189
228
|
# `issued_at` is the legacy name for starts_at.
|
190
229
|
# TODO: Move to starts_at in a next version.
|
@@ -192,13 +231,24 @@ module Gitlab
|
|
192
231
|
set_date_attribute(attr_name, attributes[attr_name])
|
193
232
|
end
|
194
233
|
|
195
|
-
%w[last_synced_at next_sync_at].each do |attr_name|
|
234
|
+
%w[last_synced_at next_sync_at activated_at].each do |attr_name|
|
196
235
|
set_datetime_attribute(attr_name, attributes[attr_name])
|
197
236
|
end
|
198
237
|
|
238
|
+
%w[
|
239
|
+
cloud_licensing_enabled
|
240
|
+
offline_cloud_licensing_enabled
|
241
|
+
auto_renew_enabled
|
242
|
+
seat_reconciliation_enabled
|
243
|
+
operational_metrics_enabled
|
244
|
+
generated_from_customers_dot
|
245
|
+
].each do |attr_name|
|
246
|
+
public_send("#{attr_name}=", attributes[attr_name] == true)
|
247
|
+
end
|
248
|
+
|
199
249
|
restrictions = attributes['restrictions']
|
200
250
|
if restrictions&.is_a?(Hash)
|
201
|
-
restrictions =
|
251
|
+
restrictions = restrictions.transform_keys(&:to_sym)
|
202
252
|
@restrictions = restrictions
|
203
253
|
end
|
204
254
|
end
|
@@ -208,7 +258,7 @@ module Gitlab
|
|
208
258
|
|
209
259
|
return unless value
|
210
260
|
|
211
|
-
|
261
|
+
public_send("#{attr_name}=", value)
|
212
262
|
end
|
213
263
|
|
214
264
|
def set_datetime_attribute(attr_name, value)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-license
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douwe Maan
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|