openproject-token 3.0.0 → 4.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 +4 -4
- data/lib/open_project/token/version.rb +1 -1
- data/lib/open_project/token.rb +22 -4
- metadata +21 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26f34040f3ddbd6546761e8e6e33f5081b95550d3795dccccdf86f3610952b52
|
|
4
|
+
data.tar.gz: d387c8130062a25183db07cbb3f43d7319836d143e3857d5271e24d99ef208eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cfc8e13d23e2d50c5f769ea7482f526b92ecf6a83075ca03790c3415ecf959e073f60f611c217f7546f02b080242d3075cfc32a9185d5e69749c895aa398659
|
|
7
|
+
data.tar.gz: bf8dd5ea2f830eeca4854560f560bcee3ccbbb6993e1d5868bf7caf40c24e0547b454e82b5aa9fde7384ac38314426cb9cac28f838197312596f6dfcf54ccc78
|
data/lib/open_project/token.rb
CHANGED
|
@@ -54,6 +54,7 @@ module OpenProject
|
|
|
54
54
|
attr_accessor :reprieve_days
|
|
55
55
|
attr_accessor :notify_admins_at, :notify_users_at, :block_changes_at
|
|
56
56
|
attr_accessor :restrictions
|
|
57
|
+
attr_accessor :features
|
|
57
58
|
|
|
58
59
|
validates_presence_of :subscriber
|
|
59
60
|
validates_presence_of :mail
|
|
@@ -91,6 +92,10 @@ module OpenProject
|
|
|
91
92
|
self.block_changes_at
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def has_feature?(name)
|
|
96
|
+
features && features.include?(name.to_sym)
|
|
97
|
+
end
|
|
98
|
+
|
|
94
99
|
##
|
|
95
100
|
# Indicates whether or not the token has expired.
|
|
96
101
|
#
|
|
@@ -134,8 +139,8 @@ module OpenProject
|
|
|
134
139
|
end
|
|
135
140
|
|
|
136
141
|
def valid_domain?(input)
|
|
137
|
-
if
|
|
138
|
-
|
|
142
|
+
if parsed_domain.is_a?(Regexp)
|
|
143
|
+
parsed_domain.match?(input)
|
|
139
144
|
else
|
|
140
145
|
domain == input
|
|
141
146
|
end
|
|
@@ -168,6 +173,7 @@ module OpenProject
|
|
|
168
173
|
hash["block_changes_at"] = self.block_changes_at if self.will_block_changes?
|
|
169
174
|
|
|
170
175
|
hash["restrictions"] = self.restrictions if self.restricted?
|
|
176
|
+
hash["features"] = self.features
|
|
171
177
|
|
|
172
178
|
hash
|
|
173
179
|
end
|
|
@@ -182,6 +188,13 @@ module OpenProject
|
|
|
182
188
|
raise ParseError, "Failed to load from json: #{e}"
|
|
183
189
|
end
|
|
184
190
|
|
|
191
|
+
def parsed_domain
|
|
192
|
+
@parsed_domain = read_domain!(domain) unless defined?(@parsed_domain)
|
|
193
|
+
|
|
194
|
+
@parsed_domain
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
|
|
185
198
|
private
|
|
186
199
|
|
|
187
200
|
def load_attributes(attributes)
|
|
@@ -191,7 +204,7 @@ module OpenProject
|
|
|
191
204
|
@subscriber = attributes["subscriber"]
|
|
192
205
|
@mail = attributes["mail"]
|
|
193
206
|
@company = attributes["company"]
|
|
194
|
-
@domain =
|
|
207
|
+
@domain = attributes["domain"]
|
|
195
208
|
|
|
196
209
|
date_attribute_keys.each do |attr|
|
|
197
210
|
value = attributes[attr]
|
|
@@ -218,6 +231,11 @@ module OpenProject
|
|
|
218
231
|
restrictions = Hash[restrictions.map { |k, v| [k.to_sym, v] }]
|
|
219
232
|
@restrictions = restrictions
|
|
220
233
|
end
|
|
234
|
+
|
|
235
|
+
features = attributes['features']
|
|
236
|
+
if features && features.is_a?(Array)
|
|
237
|
+
@features = features.map(&:to_sym)
|
|
238
|
+
end
|
|
221
239
|
end
|
|
222
240
|
|
|
223
241
|
##
|
|
@@ -253,7 +271,7 @@ module OpenProject
|
|
|
253
271
|
version
|
|
254
272
|
end
|
|
255
273
|
|
|
256
|
-
def read_domain(input)
|
|
274
|
+
def read_domain!(input)
|
|
257
275
|
return input if input.nil? || !(input.start_with?('/') && input.end_with?('/'))
|
|
258
276
|
|
|
259
277
|
# Omit the slashes of the input
|
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:
|
|
4
|
+
version: 4.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: 2023-
|
|
11
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -52,7 +52,21 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '3.5'
|
|
55
|
-
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: debug
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description:
|
|
56
70
|
email: info@openproject.com
|
|
57
71
|
executables: []
|
|
58
72
|
extensions: []
|
|
@@ -69,7 +83,7 @@ homepage: https://www.openproject.org
|
|
|
69
83
|
licenses:
|
|
70
84
|
- GPL-3.0
|
|
71
85
|
metadata: {}
|
|
72
|
-
post_install_message:
|
|
86
|
+
post_install_message:
|
|
73
87
|
rdoc_options: []
|
|
74
88
|
require_paths:
|
|
75
89
|
- lib
|
|
@@ -84,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
98
|
- !ruby/object:Gem::Version
|
|
85
99
|
version: '0'
|
|
86
100
|
requirements: []
|
|
87
|
-
rubygems_version: 3.
|
|
88
|
-
signing_key:
|
|
101
|
+
rubygems_version: 3.4.6
|
|
102
|
+
signing_key:
|
|
89
103
|
specification_version: 4
|
|
90
104
|
summary: OpenProject EE token reader
|
|
91
105
|
test_files: []
|