openproject-token 2.2.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 674fb4bda421c9bc39debd39abf5ef0103070da6c27967334c2d237480aeb893
4
- data.tar.gz: 0e9d87592b6479b00163c2ada64649b959924b8c845468419814599733fe6ab0
3
+ metadata.gz: f959bb6247948bcf6fd18e7f09c798e5b037d1a4d62bf6e1c92781e7e2e5e4e6
4
+ data.tar.gz: 9d42841010ef13874b4a3b489c1e96bb750c0650e00a94ed583008623279fbfe
5
5
  SHA512:
6
- metadata.gz: 415fd95a605f1b34205253b24873a359cf4fb9546f6bc6a3ae7442746f46075f1521cd9195009ff9e045de9139908c42124b59c68294abeeedc7c96f18e223ea
7
- data.tar.gz: a658f645da29350cb45f1ec144690a474ed316249eb0ef2f3364f97a1e1ee4bdcdd4c5472dd4f5dea85128aa4a4ccd63a84fbc2b5873ed3c4fb1bc37f415c0d8
6
+ metadata.gz: a9128f8b0bc9d6cb550dc89c1d085bed523f552f53c44800b3f51819e2b386fe77d2734178bf9c66de8bbd8506de0ee21b32fe7af3362f8bc6916a93eea7ffee
7
+ data.tar.gz: 3e3172042fac599e58fb80aaa569adfa697a30713eab643d5f4a085728a725d2e7e8b8561772a778266ee8bb5d3211bb6a46bce80d3987cec1fbc6bdc04d971d
@@ -1,5 +1,5 @@
1
1
  module OpenProject
2
2
  class Token
3
- VERSION = "2.2.0"
3
+ VERSION = "3.0.1"
4
4
  end
5
5
  end
@@ -133,6 +133,14 @@ module OpenProject
133
133
  version && Gem::Version.new(version) >= domain_required_from_version
134
134
  end
135
135
 
136
+ def valid_domain?(input)
137
+ if parsed_domain.is_a?(Regexp)
138
+ parsed_domain.match?(input)
139
+ else
140
+ domain == input
141
+ end
142
+ end
143
+
136
144
  def restricted?(key = nil)
137
145
  if key
138
146
  restricted? && restrictions.has_key?(key)
@@ -174,6 +182,13 @@ module OpenProject
174
182
  raise ParseError, "Failed to load from json: #{e}"
175
183
  end
176
184
 
185
+ def parsed_domain
186
+ @parsed_domain = read_domain!(domain) unless defined?(@parsed_domain)
187
+
188
+ @parsed_domain
189
+ end
190
+
191
+
177
192
  private
178
193
 
179
194
  def load_attributes(attributes)
@@ -245,6 +260,13 @@ module OpenProject
245
260
  version
246
261
  end
247
262
 
263
+ def read_domain!(input)
264
+ return input if input.nil? || !(input.start_with?('/') && input.end_with?('/'))
265
+
266
+ # Omit the slashes of the input
267
+ Regexp.new input[1..-2]
268
+ end
269
+
248
270
  def date_attribute_keys
249
271
  %w(starts_at issued_at expires_at notify_admins_at notify_users_at block_changes_at)
250
272
  end
@@ -257,6 +279,7 @@ module OpenProject
257
279
  @domain_required_from_version ||= Gem::Version.new('2.0')
258
280
  end
259
281
 
282
+
260
283
  ##
261
284
  # Reprieve was introduced in version 2.2.0 so could only be set
262
285
  # during generation from then onwards. All tokens before that
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-token
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenProject GmbH
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.5'
55
- description:
55
+ description:
56
56
  email: info@openproject.com
57
57
  executables: []
58
58
  extensions: []
@@ -69,7 +69,7 @@ homepage: https://www.openproject.org
69
69
  licenses:
70
70
  - GPL-3.0
71
71
  metadata: {}
72
- post_install_message:
72
+ post_install_message:
73
73
  rdoc_options: []
74
74
  require_paths:
75
75
  - lib
@@ -84,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.1.2
88
- signing_key:
87
+ rubygems_version: 3.3.7
88
+ signing_key:
89
89
  specification_version: 4
90
90
  summary: OpenProject EE token reader
91
91
  test_files: []