openproject-token 7.3.0 → 8.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/extractor.rb +1 -1
- data/lib/open_project/token/plans.rb +14 -6
- data/lib/open_project/token/version.rb +1 -1
- data/lib/open_project/token.rb +25 -26
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f48b64629de53c6fda9d9e9521c405dceb616e918943c1ea0ba63643641526c
|
|
4
|
+
data.tar.gz: 2d836191f2c4056e4bb15ababa929c6d8be0d8ee89a56d6e9a52bea3ce399daa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8126b0cf871408bd4ef7660904292b38605de41c0458bc404f28b9b1a77dfbce84696802ed6726ade0ed0c014f122cead3afe9c1ea405dd41a245bbbc9a003de
|
|
7
|
+
data.tar.gz: 96f52b9e421ca374d3cda809c79470bb9118f040497c73e743f63eb167f4525fea631a4afc7f69e0fecaea80c251fd47b2b7715f40079710f073248111ffc2e7
|
|
@@ -50,6 +50,7 @@ module OpenProject
|
|
|
50
50
|
].freeze
|
|
51
51
|
|
|
52
52
|
PREMIUM_PLAN_FEATURES = %i[
|
|
53
|
+
calculated_values
|
|
53
54
|
customize_life_cycle
|
|
54
55
|
ldap_groups
|
|
55
56
|
project_list_sharing
|
|
@@ -66,15 +67,15 @@ module OpenProject
|
|
|
66
67
|
legacy_enterprise: LEGACY_ENTERPRISE_PLAN_FEATURES,
|
|
67
68
|
|
|
68
69
|
# old plan that receives new features from the given new plan name
|
|
69
|
-
legacy_enterprise_professional:
|
|
70
|
-
legacy_enterprise_premium:
|
|
70
|
+
legacy_enterprise_professional: LEGACY_ENTERPRISE_PLAN_FEATURES | PROFESSIONAL_PLAN_FEATURES,
|
|
71
|
+
legacy_enterprise_premium: LEGACY_ENTERPRISE_PLAN_FEATURES | PREMIUM_PLAN_FEATURES | PROFESSIONAL_PLAN_FEATURES,
|
|
71
72
|
|
|
72
73
|
# new plans
|
|
73
74
|
basic: BASIC_PLAN_FEATURES,
|
|
74
|
-
professional: PROFESSIONAL_PLAN_FEATURES
|
|
75
|
-
premium: PREMIUM_PLAN_FEATURES
|
|
76
|
-
corporate: CORPORATE_PLAN_FEATURES
|
|
77
|
-
}.freeze
|
|
75
|
+
professional: PROFESSIONAL_PLAN_FEATURES | BASIC_PLAN_FEATURES,
|
|
76
|
+
premium: PREMIUM_PLAN_FEATURES | PROFESSIONAL_PLAN_FEATURES | BASIC_PLAN_FEATURES,
|
|
77
|
+
corporate: CORPORATE_PLAN_FEATURES | PREMIUM_PLAN_FEATURES | PROFESSIONAL_PLAN_FEATURES | BASIC_PLAN_FEATURES
|
|
78
|
+
}.transform_values(&:to_set).freeze
|
|
78
79
|
|
|
79
80
|
# Current plan names, sorted by inheritance
|
|
80
81
|
ACTIVE_PLAN_NAMES = %i[basic professional premium corporate].freeze
|
|
@@ -85,6 +86,13 @@ module OpenProject
|
|
|
85
86
|
# All available plan names
|
|
86
87
|
AVAILABLE_PLAN_NAMES = LEGACY_PLAN_NAMES + ACTIVE_PLAN_NAMES
|
|
87
88
|
|
|
89
|
+
# Mapping of every feature to first active plan having it
|
|
90
|
+
LOWEST_PLAN_FOR_FEATURE = ACTIVE_PLAN_NAMES.each_with_object({}) do |name, map|
|
|
91
|
+
FEATURES_PER_PLAN[name].each do |feature|
|
|
92
|
+
map[feature] ||= name
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
88
96
|
# default plan that is assigned to a token if no plan is given (especially legacy tokens)
|
|
89
97
|
DEFAULT_PLAN = :legacy_enterprise
|
|
90
98
|
end
|
data/lib/open_project/token.rb
CHANGED
|
@@ -49,9 +49,7 @@ module OpenProject
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def lowest_plan_for(feature)
|
|
52
|
-
|
|
53
|
-
OpenProject::Token::FEATURES_PER_PLAN[plan].include?(feature)
|
|
54
|
-
end
|
|
52
|
+
LOWEST_PLAN_FOR_FEATURE[feature]
|
|
55
53
|
end
|
|
56
54
|
end
|
|
57
55
|
|
|
@@ -115,12 +113,12 @@ module OpenProject
|
|
|
115
113
|
end
|
|
116
114
|
|
|
117
115
|
def available_features
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
additional_features = features || []
|
|
116
|
+
@available_features ||= begin
|
|
117
|
+
relevant_features = OpenProject::Token::FEATURES_PER_PLAN[plan] || []
|
|
118
|
+
additional_features = features || []
|
|
122
119
|
|
|
123
|
-
|
|
120
|
+
relevant_features | additional_features
|
|
121
|
+
end
|
|
124
122
|
end
|
|
125
123
|
|
|
126
124
|
##
|
|
@@ -205,30 +203,31 @@ module OpenProject
|
|
|
205
203
|
end
|
|
206
204
|
end
|
|
207
205
|
|
|
208
|
-
def attributes
|
|
209
|
-
hash = {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
206
|
+
def attributes # rubocop:disable Metrics/AbcSize
|
|
207
|
+
hash = {
|
|
208
|
+
"version" => version,
|
|
209
|
+
"subscriber" => subscriber,
|
|
210
|
+
"mail" => mail,
|
|
211
|
+
"company" => company,
|
|
212
|
+
"domain" => domain,
|
|
213
|
+
"validate_domain" => validate_domain,
|
|
214
|
+
"plan" => plan,
|
|
215
|
+
"issued_at" => issued_at,
|
|
216
|
+
"starts_at" => starts_at,
|
|
217
|
+
"trial" => trial,
|
|
218
|
+
"features" => features
|
|
219
|
+
}
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
hash["trial"] = trial
|
|
221
|
+
if will_expire?
|
|
222
|
+
hash["expires_at"] = expires_at
|
|
223
|
+
hash["reprieve_days"] = reprieve_days
|
|
224
|
+
end
|
|
225
225
|
|
|
226
226
|
hash["notify_admins_at"] = notify_admins_at if will_notify_admins?
|
|
227
227
|
hash["notify_users_at"] = notify_users_at if will_notify_users?
|
|
228
228
|
hash["block_changes_at"] = block_changes_at if will_block_changes?
|
|
229
229
|
|
|
230
230
|
hash["restrictions"] = restrictions if restricted?
|
|
231
|
-
hash["features"] = features
|
|
232
231
|
|
|
233
232
|
hash
|
|
234
233
|
end
|
|
@@ -251,7 +250,7 @@ module OpenProject
|
|
|
251
250
|
|
|
252
251
|
private
|
|
253
252
|
|
|
254
|
-
def load_attributes(attributes)
|
|
253
|
+
def load_attributes(attributes) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
255
254
|
attributes = attributes.transform_keys(&:to_s)
|
|
256
255
|
|
|
257
256
|
@version = read_version attributes
|
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:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenProject GmbH
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activemodel
|
|
@@ -48,14 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
48
48
|
requirements:
|
|
49
49
|
- - ">="
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: 3.4.
|
|
51
|
+
version: 3.4.5
|
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
54
|
- - ">="
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '0'
|
|
57
57
|
requirements: []
|
|
58
|
-
rubygems_version: 3.6.
|
|
58
|
+
rubygems_version: 3.6.9
|
|
59
59
|
specification_version: 4
|
|
60
60
|
summary: OpenProject EE token reader
|
|
61
61
|
test_files: []
|