openproject-token 5.5.0 → 6.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/plans.rb +8 -2
 - data/lib/open_project/token/version.rb +1 -1
 - data/lib/open_project/token.rb +16 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 77fc561da569bc057220c91166f038cd49f8e645d5b9dde533aceb1c80bce8ea
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c9c2a688b6bf1d1f9ab2547e8b19ce42c45e1dc7f0f7500210a99be3d767786f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9d992f97a309f26e11cba8cb5e85fb739f5a31d3efd5278e05c967033ca29cf400c7d8cbb49875ff952f359328c312310a6d842aed5c7526d7be27bfc5077d1e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3d752d3adafa60f6c6af059e5b06ffa1cc0a955e72b55d77440d4e3fac443b1a72b48e0420eaa0cfb0acdec9c52eb242b41988cb437eeaf6eba7f1dc7fb979d7
         
     | 
| 
         @@ -8,7 +8,6 @@ module OpenProject 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  conditional_highlighting
         
     | 
| 
       9 
9 
     | 
    
         
             
                  custom_actions
         
     | 
| 
       10 
10 
     | 
    
         
             
                  custom_field_hierarchies
         
     | 
| 
       11 
     | 
    
         
            -
                  customize_life_cycle
         
     | 
| 
       12 
11 
     | 
    
         
             
                  date_alerts
         
     | 
| 
       13 
12 
     | 
    
         
             
                  define_custom_style
         
     | 
| 
       14 
13 
     | 
    
         
             
                  edit_attribute_groups
         
     | 
| 
         @@ -65,6 +64,10 @@ module OpenProject 
     | 
|
| 
       65 
64 
     | 
    
         
             
                  # old plan that is used for all plans that do not have a plan set
         
     | 
| 
       66 
65 
     | 
    
         
             
                  legacy_enterprise: LEGACY_ENTERPRISE_PLAN_FEATURES,
         
     | 
| 
       67 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
                  # old plan that receives new features from the given new plan name
         
     | 
| 
      
 68 
     | 
    
         
            +
                  legacy_enterprise_professional: (LEGACY_ENTERPRISE_PLAN_FEATURES + PROFESSIONAL_PLAN_FEATURES).uniq,
         
     | 
| 
      
 69 
     | 
    
         
            +
                  legacy_enterprise_premium: (LEGACY_ENTERPRISE_PLAN_FEATURES + PREMIUM_PLAN_FEATURES + PROFESSIONAL_PLAN_FEATURES).uniq,
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
       68 
71 
     | 
    
         
             
                  # new plans
         
     | 
| 
       69 
72 
     | 
    
         
             
                  basic: BASIC_PLAN_FEATURES,
         
     | 
| 
       70 
73 
     | 
    
         
             
                  professional: PROFESSIONAL_PLAN_FEATURES + BASIC_PLAN_FEATURES,
         
     | 
| 
         @@ -75,8 +78,11 @@ module OpenProject 
     | 
|
| 
       75 
78 
     | 
    
         
             
                # Current plan names, sorted by inheritance
         
     | 
| 
       76 
79 
     | 
    
         
             
                ACTIVE_PLAN_NAMES = %i[basic professional premium corporate].freeze
         
     | 
| 
       77 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
                LEGACY_PLAN_NAMES = %i[legacy_enterprise legacy_enterprise_professional
         
     | 
| 
      
 82 
     | 
    
         
            +
                                       legacy_enterprise_premium legacy_enterprise_corporate].freeze
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
       78 
84 
     | 
    
         
             
                # All available plan names
         
     | 
| 
       79 
     | 
    
         
            -
                AVAILABLE_PLAN_NAMES =  
     | 
| 
      
 85 
     | 
    
         
            +
                AVAILABLE_PLAN_NAMES = LEGACY_PLAN_NAMES + ACTIVE_PLAN_NAMES
         
     | 
| 
       80 
86 
     | 
    
         | 
| 
       81 
87 
     | 
    
         
             
                # default plan that is assigned to a token if no plan is given (especially legacy tokens)
         
     | 
| 
       82 
88 
     | 
    
         
             
                DEFAULT_PLAN = :legacy_enterprise
         
     | 
    
        data/lib/open_project/token.rb
    CHANGED
    
    | 
         @@ -58,7 +58,8 @@ module OpenProject 
     | 
|
| 
       58 
58 
     | 
    
         
             
                include ActiveModel::Validations
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                attr_reader :version, :plan
         
     | 
| 
       61 
     | 
    
         
            -
                attr_accessor :subscriber, :mail, :company, :domain, : 
     | 
| 
      
 61 
     | 
    
         
            +
                attr_accessor :subscriber, :mail, :company, :domain, :validate_domain,
         
     | 
| 
      
 62 
     | 
    
         
            +
                              :starts_at, :issued_at, :expires_at, :reprieve_days, :notify_admins_at,
         
     | 
| 
       62 
63 
     | 
    
         
             
                              :notify_users_at, :block_changes_at, :restrictions, :features
         
     | 
| 
       63 
64 
     | 
    
         | 
| 
       64 
65 
     | 
    
         
             
                validates_presence_of :subscriber
         
     | 
| 
         @@ -74,6 +75,8 @@ module OpenProject 
     | 
|
| 
       74 
75 
     | 
    
         
             
                  record.errors.add attr, "is not a date" if !value.is_a?(Date)
         
     | 
| 
       75 
76 
     | 
    
         
             
                end
         
     | 
| 
       76 
77 
     | 
    
         | 
| 
      
 78 
     | 
    
         
            +
                validate :expires_at_set_when_domain_opted_out
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       77 
80 
     | 
    
         
             
                validates_each :restrictions, allow_nil: true do |record, attr, value|
         
     | 
| 
       78 
81 
     | 
    
         
             
                  record.errors.add attr, :invalid if !value.is_a?(Hash)
         
     | 
| 
       79 
82 
     | 
    
         
             
                end
         
     | 
| 
         @@ -154,6 +157,8 @@ module OpenProject 
     | 
|
| 
       154 
157 
     | 
    
         | 
| 
       155 
158 
     | 
    
         
             
                # tokens with no version or a version lower than 2.0 don't have the attributes company or domain
         
     | 
| 
       156 
159 
     | 
    
         
             
                def validate_domain?
         
     | 
| 
      
 160 
     | 
    
         
            +
                  return validate_domain unless validate_domain.nil?
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
       157 
162 
     | 
    
         
             
                  version && Gem::Version.new(version) >= domain_required_from_version
         
     | 
| 
       158 
163 
     | 
    
         
             
                end
         
     | 
| 
       159 
164 
     | 
    
         | 
| 
         @@ -183,6 +188,7 @@ module OpenProject 
     | 
|
| 
       183 
188 
     | 
    
         
             
                  hash["mail"]             = mail
         
     | 
| 
       184 
189 
     | 
    
         
             
                  hash["company"]          = company
         
     | 
| 
       185 
190 
     | 
    
         
             
                  hash["domain"]           = domain
         
     | 
| 
      
 191 
     | 
    
         
            +
                  hash["validate_domain"]  = validate_domain
         
     | 
| 
       186 
192 
     | 
    
         
             
                  hash["plan"]             = plan
         
     | 
| 
       187 
193 
     | 
    
         | 
| 
       188 
194 
     | 
    
         
             
                  hash["issued_at"]        = issued_at
         
     | 
| 
         @@ -226,6 +232,7 @@ module OpenProject 
     | 
|
| 
       226 
232 
     | 
    
         
             
                  @mail = attributes["mail"]
         
     | 
| 
       227 
233 
     | 
    
         
             
                  @company = attributes["company"]
         
     | 
| 
       228 
234 
     | 
    
         
             
                  @domain = attributes["domain"]
         
     | 
| 
      
 235 
     | 
    
         
            +
                  @validate_domain = attributes["validate_domain"]
         
     | 
| 
       229 
236 
     | 
    
         | 
| 
       230 
237 
     | 
    
         
             
                  date_attribute_keys.each do |attr|
         
     | 
| 
       231 
238 
     | 
    
         
             
                    value = attributes[attr]
         
     | 
| 
         @@ -326,5 +333,13 @@ module OpenProject 
     | 
|
| 
       326 
333 
     | 
    
         
             
                def apply_default_reprieve?(version)
         
     | 
| 
       327 
334 
     | 
    
         
             
                  Gem::Version.new(version) < Gem::Version.new("2.2.0")
         
     | 
| 
       328 
335 
     | 
    
         
             
                end
         
     | 
| 
      
 336 
     | 
    
         
            +
             
     | 
| 
      
 337 
     | 
    
         
            +
                # We want to ensure an expires_at is set
         
     | 
| 
      
 338 
     | 
    
         
            +
                # when there is no domain present
         
     | 
| 
      
 339 
     | 
    
         
            +
                def expires_at_set_when_domain_opted_out
         
     | 
| 
      
 340 
     | 
    
         
            +
                  if validate_domain == false && expires_at.nil?
         
     | 
| 
      
 341 
     | 
    
         
            +
                    errors.add(:expires_at, "must be present when domain is opted out")
         
     | 
| 
      
 342 
     | 
    
         
            +
                  end
         
     | 
| 
      
 343 
     | 
    
         
            +
                end
         
     | 
| 
       329 
344 
     | 
    
         
             
              end
         
     | 
| 
       330 
345 
     | 
    
         
             
            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:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 6.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - OpenProject GmbH
         
     | 
| 
       8 
8 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       9 
9 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       10 
     | 
    
         
            -
            date: 2025- 
     | 
| 
      
 10 
     | 
    
         
            +
            date: 2025-05-07 00:00:00.000000000 Z
         
     | 
| 
       11 
11 
     | 
    
         
             
            dependencies:
         
     | 
| 
       12 
12 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       13 
13 
     | 
    
         
             
              name: activemodel
         
     |