Skip to content

Instantly share code, notes, and snippets.

@markasoftware
Last active July 18, 2025 20:42
Show Gist options
  • Save markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 to your computer and use it in GitHub Desktop.
Save markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 to your computer and use it in GitHub Desktop.
OpenProject Enterprise mode for free
############ If you are using DOCKER all-in-one image, create Dockerfile like: ################
############ FROM openproject/openproject:16 ################
############ COPY ./enterprise_token.rb app/models/enterprise_token.rb ################
############ If you are runing a manual installation: ################
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ If using some other set up (eg docker-compose), read the comments on ################
############ https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 ################
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
class EnterpriseToken < ApplicationRecord
class << self
def current
self.new
end
def allows_to?(feature)
true
end
def active?
true
end
def hide_banners?
true
end
def show_banners?
false
end
def banner_type_for(feature:)
nil
end
end
def token_object
Class.new do
def has_feature?(feature)
true
end
def will_expire?
false
end
def mail
"[email protected]"
end
def subscriber
"markasoftware-free-enterprise-mode"
end
def company
"markasoftware"
end
def domain
"markasoftware.com"
end
def issued_at
Time.zone.today - 1
end
def starts_at
Time.zone.today - 1
end
def expires_at
Time.zone.today + 1
end
def reprieve_days
nil
end
def reprieve_days_left
69
end
def restrictions
nil
end
def available_features
[]
end
def plan
"markasoftware_free_enterprise_mode"
end
def features
[]
end
def version
69
end
end.new
end
def will_expire?
false
end
def mail
"[email protected]"
end
def subscriber
"markasoftware-free-enterprise-mode"
end
def company
"markasoftware"
end
def domain
"markasoftware.com"
end
def issued_at
Time.zone.today - 1
end
def starts_at
Time.zone.today - 1
end
def expires_at
Time.zone.today + 1
end
def reprieve_days
nil
end
def reprieve_days_left
69
end
def restrictions
nil
end
def available_features
[]
end
def plan
"markasoftware_free_enterprise_mode"
end
def features
[]
end
def version
69
end
def allows_to?(action)
true
end
def expired?(reprieve: true)
false
end
def invalid_domain?
false
end
end
@scalenow
Copy link

@positiveque thanks

@javiervalerocelada
Copy link

@positiveque Is working on docker?

@positiveque
Copy link

@positiveque Is working on docker?

Yes, sure. I use it in docker-compose.yml like this:

  volumes:
    - "/docker/openproject/enterprise/enterprise_token.rb:/app/app/models/enterprise_token.rb"

@javiervalerocelada
Copy link

@positiveque with version openproject-dev?

@positiveque
Copy link

@positiveque with version openproject-dev?

I use image for production "openproject/openproject:16-slim" and don't know about openproject-dev.

@Jerin-Altnix
Copy link

Its not working on the 16.1.1

@positiveque
Copy link

Its not working on the 16.1.1

I just checked and it works on the 16.1.1. Can you give more details?

@AFFLatusss
Copy link

AFFLatusss commented Jul 9, 2025

Anyone tried on OpenProject 16.1.1?

Every enterprise features is working but baseline comparison in work packages? any idea?

Like the options are available but not working...

@Jerin-Altnix
Copy link

Hey @positiveque , thanks for your support. It was my mistake, I had upgraded OpenProject from version 15 to 16 and tried using the token, but it didn’t work. I was also running PostgreSQL 13 at the time. I’ve now done a fresh setup, and everything is working fine.

@jafaripur
Copy link

jafaripur commented Jul 16, 2025

Work before 16.2, in version 16.2 error occurred!

@CMDAEW
Copy link

CMDAEW commented Jul 16, 2025

good open source knows how to protect itself :) all the best to openproject. hit me up if u want a free trial ;)

@samip5
Copy link

samip5 commented Jul 16, 2025

They seem to have added quite a bit of methods to the token class..

@christophwolff
Copy link

Give it some time. And a fix will be made ;)

@samip5
Copy link

samip5 commented Jul 16, 2025

Yes, I'm sure of that. Gonna take a stab at it myself. Shouldn't be too difficult to mock the added functions. :)

@markasoftware
Copy link
Author

yep they added some new methods, will look into it soon.

@samip5
Copy link

samip5 commented Jul 16, 2025

Cannot open the token page in UI, but that's fine. :D

Let me just leave this here:

class EnterpriseToken < ApplicationRecord
  class << self
    def current
      self.new
    end

    def allows_to?(feature)
      true
    end

    def active?
      true
    end

    def hide_banners?
      true
    end

    def show_banners?
      false
    end

    def banner_type_for(feature:)
      nil
    end

    def all_tokens
      [new]
    end

    def active_tokens
      [new]
    end

    def active_non_trial_tokens
      [new]
    end

    def active_trial_token
      nil
    end

    def table_exists?
      true
    end

    def trial_only?
      false
    end

    def available_features
      [:all_features]
    end

    def non_trialling_features
      [:all_features]
    end

    def trialling_features
      []
    end

    def trialling?(feature)
      false
    end

    def user_limit
      nil
    end

    def set_active_tokens
      [new]
    end

    def clear_current_tokens_cache
      true
    end
  end

  def token_object
    @token_object ||= Class.new do
      def has_feature?(feature)
        true
      end

      def will_expire?
        false
      end

      def mail
        "[email protected]"
      end

      def subscriber
        "markasoftware-free-enterprise-mode"
      end

      def company
        "markasoftware"
      end

      def domain
        "markasoftware.com"
      end

      def issued_at
        Time.zone.today - 1
      end

      def starts_at
        Time.zone.today - 1
      end

      def expires_at
        Time.zone.today + 1
      end

      def reprieve_days
        nil
      end

      def reprieve_days_left
        69
      end

      def restrictions
        nil
      end

      def available_features
        [:all_features]
      end

      def plan
        "markasoftware_free_enterprise_mode"
      end

      def features
        [:all_features]
      end
      
      def version
        70
      end

      def started?
        true
      end

      def trial?
        false
      end

      def active?(reprieve: true)
        true
      end

      def expired?(reprieve: true)
        false
      end

      def validate_domain?
        false
      end

      def valid_domain?(hostname)
        true
      end
    end.new
  end

  def will_expire?
    false
  end

  def mail
    "[email protected]"
  end

  def subscriber
    "markasoftware-free-enterprise-mode"
  end

  def company
    "markasoftware"
  end

  def domain
    "markasoftware.com"
  end

  def issued_at
    Time.zone.today - 1
  end

  def starts_at
    Time.zone.today - 1
  end

  def expires_at
    Time.zone.today + 1
  end

  def reprieve_days
    nil
  end

  def reprieve_days_left
    69
  end

  def restrictions
    nil
  end

  def available_features
    [:all_features]
  end

  def plan
    "markasoftware_free_enterprise_mode"
  end

  def features
    [:all_features]
  end
  
  def version
    70
  end

  def allows_to?(action)
    true
  end

  def expired?(reprieve: true)
    false
  end

  def invalid_domain?
    false
  end

  # Missing instance methods from original
  def expiring_soon?
    false
  end

  def in_grace_period?
    false
  end

  def statuses
    []
  end

  def unlimited_users?
    true
  end

  def max_active_users
    nil
  end

  def sort_key
    [Time.zone.today + 1000.years, Time.zone.today - 1]
  end

  def days_left
    365000 # A very large number
  end

  def started?
    true
  end

  def trial?
    false
  end

  def active?
    true
  end

  def clear_current_tokens_cache
    true
  end
end

@GameDr04
Copy link

It's 10/10 hilarious to me that you incremented the version number @samip5 .
"one better than 69"

@scalenow
Copy link

@markasoftware thanks waiting for your input

@javiervalerocelada
Copy link

hi, i have just upgrade to 16.2 i have notice that status color in workpackages list is lost. view image:
sample

@samip5
Copy link

samip5 commented Jul 17, 2025

The features I care about works so YMMV.

@javiervalerocelada
Copy link

javiervalerocelada commented Jul 17, 2025

@samip5 or @markasoftware Can you confirm to me if you can enable highlighting on work package table configuration?

@samip5
Copy link

samip5 commented Jul 18, 2025

@samip5 or @markasoftware Can you confirm to me if you can enable highlighting on work package table configuration?

You could just play with the features thing in the model..

@javiervalerocelada
Copy link

@samip5 or @markasoftware Can you confirm to me if you can enable highlighting on work package table configuration?

You could just play with the features thing in the model..

Puffff, really i think that this is generated by new configuration in the file: enterprise_token so that i will have to waiting to solution of @markasoftware

@samip5
Copy link

samip5 commented Jul 18, 2025

So as I suspected, one needs to just play with the features things on the model. This seems to work, and the token page is also accessible: https://github.com/skyssolutions/containers/blob/1a1ba1e3e730c2192755f0470473b66a4f524fc5/apps/openproject/enterprise.rb
Container with the patch is at: ghcr.io/skyssolutions/openproject:16.2.0@sha256:f6ed2ec546eaf0159eed2e8b7cb81d59054806765582c3d81eb0d2de0b6fe28e

@javiervalerocelada
Copy link

Así que, como sospechaba, hay que jugar con las características del modelo. Esto parece funcionar, y también se puede acceder a la página del token: https://github.com/skyssolutions/containers/blob/1a1ba1e3e730c2192755f0470473b66a4f524fc5/apps/openproject/enterprise.rb contenedor con el parche está en: ghcr.io/skyssolutions/openproject:16.2.0@sha256:f6ed2ec546eaf0159eed2e8b7cb81d59054806765582c3d81eb0d2de0b6fe28e

ok, i have update to your file enterprise_token.rb and i can to access to token page but in page of workpackages list, filter, the option higtlighting color is disabled. Can you help me?

@samip5
Copy link

samip5 commented Jul 18, 2025

Así que, como sospechaba, hay que jugar con las características del modelo. Esto parece funcionar, y también se puede acceder a la página del token: https://github.com/skyssolutions/containers/blob/1a1ba1e3e730c2192755f0470473b66a4f524fc5/apps/openproject/enterprise.rb contenedor con el parche está en: ghcr.io/skyssolutions/openproject:16.2.0@sha256:f6ed2ec546eaf0159eed2e8b7cb81d59054806765582c3d81eb0d2de0b6fe28e

ok, i have update to your file enterprise_token.rb and i can to access to token page but in page of workpackages list, filter, the option higtlighting color is disabled. Can you help me?

I don’t use those so no.

@javiervalerocelada
Copy link

@markasoftware i have update to file enterprise_token.rb and i can to access to token page but in page of workpackages list, filter, the option higtlighting color is disabled. Can you help me?

@javiervalerocelada
Copy link

Solemone can tell me if it is working highlighting on 16.2 and this case send me his version of enterprise_token.rb

@deconf
Copy link

deconf commented Jul 18, 2025

@javiervalerocelada if ChatGPT or Grok doesn't ring a bell, in the future you should try it:

class EnterpriseToken < ApplicationRecord
  include ActiveModel::Serialization

  class << self
    def current
      new
    end

    def allows_to?(feature)
      feature_str = feature.to_s
      case feature_str
      when "conditional_highlighting"
        true
      when "attribute_highlighting", "attribute_highlighting_v2"
        true
      when "baseline_comparison", "baseline_", "condition_", "work_pack", "gantt_pdf", "readonly_", "team_planner", "cost_reporting", "multi_select_custom_fields", "custom_workflows", "board_view", "reportings", "project_attributes", "time_and_costs", "backlogs", "version_comparison", "enterprise_base", "all_features", "custom_panels", "dashboards", "project_filters", "work_package_sharing", "resource_booking", "meeting", "bim", "ldap_groups", "budgeting", "earned_value_management", "project_import", "work_package_query_customization", "work_package_tracking", "work_package_hierarchy", "work_package_export", "cost_object_tracking", "time_tracking_advanced", "team_collaboration", "document_management", "risk_management", "change_management", "portfolio_management", "resource_management", "capacity_planning", "scheduling", "milestone_tracking", "task_dependencies", "status_rollup", "custom_fields_advanced", "reporting_advanced", "forecasting", "integrations", "api_extensions", "security_enhancements"
        true
      else
        true
      end
    end

    def active?
      true
    end

    def hide_banners?
      true
    end

    def show_banners?
      false
    end

    def banner_type_for(feature:)
      nil
    end

    def all_tokens
      [new]
    end

    def active_tokens
      [new]
    end

    def active_non_trial_tokens
      [new]
    end

    def active_trial_token
      nil
    end

    def table_exists?
      true
    end

    def trial_only?
      false
    end

    def available_features
      [:conditional_highlighting, :attribute_highlighting, :attribute_highlighting_v2, :enterprise_base, :all_features, :baseline_comparison, :baseline_, :condition_, :work_pack, :gantt_pdf, :readonly_, :team_planner, :cost_reporting, :multi_select_custom_fields, :custom_workflows, :board_view, :reportings, :project_attributes, :time_and_costs, :backlogs, :version_comparison, :custom_panels, :dashboards, :project_filters, :work_package_sharing, :resource_booking, :meeting, :bim, :ldap_groups, :budgeting, :earned_value_management, :project_import, :work_package_query_customization, :work_package_tracking, :work_package_hierarchy, :work_package_export, :cost_object_tracking, :time_tracking_advanced, :team_collaboration, :document_management, :risk_management, :change_management, :portfolio_management, :resource_management, :capacity_planning, :scheduling, :milestone_tracking, :task_dependencies, :status_rollup, :custom_fields_advanced, :reporting_advanced, :forecasting, :integrations, :api_extensions, :security_enhancements]
    end

    def non_trialling_features
      [:conditional_highlighting, :attribute_highlighting, :attribute_highlighting_v2, :enterprise_base, :all_features, :baseline_comparison, :baseline_, :condition_, :work_pack, :gantt_pdf, :readonly_, :team_planner, :cost_reporting, :multi_select_custom_fields, :custom_workflows, :board_view, :reportings, :project_attributes, :time_and_costs, :backlogs, :version_comparison, :custom_panels, :dashboards, :project_filters, :work_package_sharing, :resource_booking, :meeting, :bim, :ldap_groups, :budgeting, :earned_value_management, :project_import, :work_package_query_customization, :work_package_tracking, :work_package_hierarchy, :work_package_export, :cost_object_tracking, :time_tracking_advanced, :team_collaboration, :document_management, :risk_management, :change_management, :portfolio_management, :resource_management, :capacity_planning, :scheduling, :milestone_tracking, :task_dependencies, :status_rollup, :custom_fields_advanced, :reporting_advanced, :forecasting, :integrations, :api_extensions, :security_enhancements]
    end

    def trialling_features
      []
    end

    def trialling?(feature)
      false
    end

    def user_limit
      nil
    end

    def set_active_tokens
      [new]
    end

    def clear_current_tokens_cache
      true
    end
  end

  def token_object
    @token_object ||= OpenStruct.new(
      has_feature?: ->(feature) { true },
      will_expire?: false,
      expired?: ->(reprieve: true) { false },
      validate_domain?: false,
      valid_domain?: ->(_host) { true },
      subscriber: "Open Source Community",
      mail: "[email protected]",
      company: "OpenProject Community",
      domain: Setting.host_name,
      issued_at: Date.today,
      starts_at: Date.today,
      expires_at: nil,
      restrictions: {}
    )
  end

  def allows_to?(action)
    true
  end

  def expired?(reprieve: true)
    false
  end

  def invalid_domain?
    false
  end

  def unlimited_users?
    true
  end

  def max_active_users
    nil
  end

  def sort_key
    [nil, Date.today]
  end

  def days_left
    nil
  end

  private

  def strip_encoded_token
    self.encoded_token = nil
  end

  def load_token!
    @token_object
  end

  def valid_token_object
    true
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment