openproject-token 2.2.0 → 3.0.0

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: c70ad73f805a38cc1846b8c5b1db6492efda10e039c0d417f41577ba4aa0c50d
4
+ data.tar.gz: ddc82e67199f997413a1493eef6518f238821eb5f995cf07d945b7fec95cb8b6
5
5
  SHA512:
6
- metadata.gz: 415fd95a605f1b34205253b24873a359cf4fb9546f6bc6a3ae7442746f46075f1521cd9195009ff9e045de9139908c42124b59c68294abeeedc7c96f18e223ea
7
- data.tar.gz: a658f645da29350cb45f1ec144690a474ed316249eb0ef2f3364f97a1e1ee4bdcdd4c5472dd4f5dea85128aa4a4ccd63a84fbc2b5873ed3c4fb1bc37f415c0d8
6
+ metadata.gz: abd224aeb838bac009ab74e4aa9d31c60891c4d860351c21e18d2bc52aaca39be0bbf008e304b58e842194234cf3e6070b9de2a59f6086fde577abdaaa84a773
7
+ data.tar.gz: eb3bb63292374c49f3d6cf39bebeb7584c64b91835107f520d995cebb4047e3e285f83481948b209e40e3364f85be909346f362540548fbe017665c47d932b47
@@ -1,5 +1,5 @@
1
1
  module OpenProject
2
2
  class Token
3
- VERSION = "2.2.0"
3
+ VERSION = "3.0.0"
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 domain.is_a?(Regexp)
138
+ 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)
@@ -183,7 +191,7 @@ module OpenProject
183
191
  @subscriber = attributes["subscriber"]
184
192
  @mail = attributes["mail"]
185
193
  @company = attributes["company"]
186
- @domain = attributes["domain"]
194
+ @domain = read_domain attributes["domain"]
187
195
 
188
196
  date_attribute_keys.each do |attr|
189
197
  value = attributes[attr]
@@ -245,6 +253,13 @@ module OpenProject
245
253
  version
246
254
  end
247
255
 
256
+ def read_domain(input)
257
+ return input if input.nil? || !(input.start_with?('/') && input.end_with?('/'))
258
+
259
+ # Omit the slashes of the input
260
+ Regexp.new input[1..-2]
261
+ end
262
+
248
263
  def date_attribute_keys
249
264
  %w(starts_at issued_at expires_at notify_admins_at notify_users_at block_changes_at)
250
265
  end
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.0
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: []