openproject-token 6.0.0 → 7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77fc561da569bc057220c91166f038cd49f8e645d5b9dde533aceb1c80bce8ea
4
- data.tar.gz: c9c2a688b6bf1d1f9ab2547e8b19ce42c45e1dc7f0f7500210a99be3d767786f
3
+ metadata.gz: f6ac0004df7e78a0a684a2f03f3ea6ef7b2c17412fc3733715b184975d70cfed
4
+ data.tar.gz: 0405bb6c40b5644554552743acac9e7af7882cc7a8a489ed3e6b98f01db29bca
5
5
  SHA512:
6
- metadata.gz: 9d992f97a309f26e11cba8cb5e85fb739f5a31d3efd5278e05c967033ca29cf400c7d8cbb49875ff952f359328c312310a6d842aed5c7526d7be27bfc5077d1e
7
- data.tar.gz: 3d752d3adafa60f6c6af059e5b06ffa1cc0a955e72b55d77440d4e3fac443b1a72b48e0420eaa0cfb0acdec9c52eb242b41988cb437eeaf6eba7f1dc7fb979d7
6
+ metadata.gz: 9a438c178966e9a0036c411848d183cba6479607dede79b80802b4f01e0631375c7f08035bf63c6fa06e265b166ef3942fc84fb10f13f7bcc4e9ece4e5eff59c
7
+ data.tar.gz: 00d0bbb67969aff8a5a45b9be94232f314ecd461d221561ef5164a546016b514fd6ab4b080e54a8fa4dcf969110206169f521d0d47952dafe85e1f1d9f36fce3
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OpenProject
4
4
  class Token
5
- VERSION = "6.0.0"
5
+ VERSION = "7.0.0"
6
6
  end
7
7
  end
@@ -60,7 +60,7 @@ module OpenProject
60
60
  attr_reader :version, :plan
61
61
  attr_accessor :subscriber, :mail, :company, :domain, :validate_domain,
62
62
  :starts_at, :issued_at, :expires_at, :reprieve_days, :notify_admins_at,
63
- :notify_users_at, :block_changes_at, :restrictions, :features
63
+ :notify_users_at, :block_changes_at, :trial, :restrictions, :features
64
64
 
65
65
  validates_presence_of :subscriber
66
66
  validates_presence_of :mail
@@ -76,6 +76,7 @@ module OpenProject
76
76
  end
77
77
 
78
78
  validate :expires_at_set_when_domain_opted_out
79
+ validate :expires_at_set_when_trial
79
80
 
80
81
  validates_each :restrictions, allow_nil: true do |record, attr, value|
81
82
  record.errors.add attr, :invalid if !value.is_a?(Hash)
@@ -101,6 +102,10 @@ module OpenProject
101
102
  block_changes_at
102
103
  end
103
104
 
105
+ def trial?
106
+ trial
107
+ end
108
+
104
109
  def has_feature?(name)
105
110
  available_features.include?(name.to_sym)
106
111
  end
@@ -196,6 +201,8 @@ module OpenProject
196
201
  hash["expires_at"] = expires_at if will_expire?
197
202
  hash["reprieve_days"] = reprieve_days if will_expire?
198
203
 
204
+ hash["trial"] = trial
205
+
199
206
  hash["notify_admins_at"] = notify_admins_at if will_notify_admins?
200
207
  hash["notify_users_at"] = notify_users_at if will_notify_users?
201
208
  hash["block_changes_at"] = block_changes_at if will_block_changes?
@@ -272,6 +279,8 @@ module OpenProject
272
279
  end
273
280
 
274
281
  @plan = attributes["plan"].presence&.to_sym || OpenProject::Token::DEFAULT_PLAN
282
+
283
+ @trial = !!attributes["trial"]
275
284
  end
276
285
 
277
286
  ##
@@ -341,5 +350,12 @@ module OpenProject
341
350
  errors.add(:expires_at, "must be present when domain is opted out")
342
351
  end
343
352
  end
353
+
354
+ # We want to ensure an expires_at is set when the token is a trial token
355
+ def expires_at_set_when_trial
356
+ if trial? && expires_at.nil?
357
+ errors.add(:expires_at, "must be present for a trial")
358
+ end
359
+ end
344
360
  end
345
361
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-token
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenProject GmbH
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-07 00:00:00.000000000 Z
10
+ date: 2025-05-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activemodel