Changeset - 31e119cb02ef
[Not reviewed]
Bradley M. Kuhn - 11 years ago 2014-07-03 01:03:21
bkuhn@sfconservancy.org
Remove license check code: GPL'd works like this should be unencumbered.
8 files changed with 0 insertions and 385 deletions:
0 comments (0 inline, 0 general)
rhodecode/bin/rhodecode_config.py
Show inline comments
 
@@ -93,8 +93,6 @@ def _run(argv):
 
        print parser.print_help()
 
        sys.exit(0)
 
    # defaults that can be overwritten by arguments
 
    from rhodecode.model.license import LicenseModel
 
    license_token = LicenseModel.generate_license_token()
 
    tmpl_stored_args = {
 
        'http_server': 'waitress',
 
        'lang': 'en',
 
@@ -102,7 +100,6 @@ def _run(argv):
 
        'host': '127.0.0.1',
 
        'port': 5000,
 
        'error_aggregation_service': None,
 
        'license_token': license_token
 
    }
 
    if other:
 
        # parse arguments, we assume only first is correct
rhodecode/config/routing.py
Show inline comments
 
@@ -346,11 +346,6 @@ def make_map(config):
 
        m.connect("admin_settings_system_update", "/settings/system/updates",
 
                  action="settings_system_update", conditions=dict(method=["GET"]))
 

	
 
        m.connect("admin_settings_license", "/settings/license",
 
                  action="settings_license", conditions=dict(method=["POST"]))
 
        m.connect("admin_settings_license", "/settings/license",
 
                  action="settings_license", conditions=dict(method=["GET"]))
 

	
 
    #ADMIN MY ACCOUNT
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/my_account') as m:
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -42,7 +42,6 @@ from rhodecode.lib.utils import repo2db_
 
from rhodecode.model.db import RhodeCodeUi, Repository, RhodeCodeSetting
 
from rhodecode.model.forms import ApplicationSettingsForm, \
 
    ApplicationUiSettingsForm, ApplicationVisualisationForm
 
from rhodecode.model.license import LicenseModel
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.model.notification import EmailNotificationModel
 
from rhodecode.model.meta import Session
 
@@ -517,63 +516,3 @@ class SettingsController(BaseController)
 
        c.important_notices = latest['general']
 

	
 
        return render('admin/settings/settings_system_update.html'),
 

	
 
    @HasPermissionAllDecorator('hg.admin')
 
    def settings_license(self):
 
        """GET /admin/settings/hooks: All items in the collection"""
 
        # url('admin_settings_license')
 
        c.active = 'license'
 
        if request.POST:
 
            form_result = request.POST
 
            try:
 
                sett1 = RhodeCodeSetting.create_or_update('license_key',
 
                                    form_result['rhodecode_license_key'],
 
                                    'unicode')
 
                Session().add(sett1)
 
                Session().commit()
 
                set_rhodecode_config(config)
 
                h.flash(_('Updated license information'),
 
                        category='success')
 

	
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('Error occurred during updating license info'),
 
                        category='error')
 

	
 
            return redirect(url('admin_settings_license'))
 

	
 
        defaults = RhodeCodeSetting.get_app_settings()
 
        defaults.update(self._get_hg_ui_settings())
 

	
 
        import rhodecode
 
        c.rhodecode_ini = rhodecode.CONFIG
 
        c.license_token = c.rhodecode_ini.get('license_token')
 
        c.generated_license_token = LicenseModel.generate_license_token()
 
        c.license_info = {}
 
        c.license_loaded = False
 
        # try to read info about license
 
        try:
 
            license_key = defaults.get('rhodecode_license_key')
 
            if c.license_token and license_key:
 
                c.license_info = json.loads(
 
                    LicenseModel(key=c.license_token).decrypt(license_key))
 
                expires = h.fmt_date(h.time_to_datetime(c.license_info['valid_till']))
 
                now = time.time()
 
                if 0 < (c.license_info['valid_till'] - now) < 60*60*24*7:
 
                    h.flash(_('Your license will expire on %s, please contact '
 
                              'support to extend your license.' % expires), category='warning')
 
                if c.license_info['valid_till'] - now < 0:
 
                    h.flash(_('Your license has expired on %s, please contact '
 
                              'support to extend your license.' % expires), category='error')
 
                c.license_loaded = True
 
        except Exception, e:
 
            log.error(traceback.format_exc())
 
            h.flash(_('Unexpected error while reading license key. Please '
 
                      'make sure your license token and key are correct'),
 
                    category='error')
 

	
 
        return htmlfill.render(
 
            render('admin/settings/settings.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False)
rhodecode/lib/hooks.py
Show inline comments
 
@@ -258,30 +258,6 @@ def check_allowed_create_user(user_dict,
 
        if not allowed:
 
            raise UserCreationError(reason)
 

	
 
    # license limit hook
 
    import rhodecode
 
    from rhodecode.model.license import LicenseModel
 
    license_token = rhodecode.CONFIG.get('license_token')
 
    license_key = LicenseModel.get_license_key()
 
    license_info = LicenseModel.get_license_info(
 
        license_token=license_token, enc_license_key=license_key,
 
        fill_defaults=True)
 
    expiration_check = False
 
    if expiration_check:
 
        now = time.time()
 
        #check expiration
 
        if now > license_info['valid_till']:
 
            reason = ('Your license has expired, '
 
                      'please contact support to extend your license.')
 
            raise UserCreationError(reason)
 
    # user count check
 
    cur_user_count = User.query().count()
 
    if cur_user_count > int(license_info['users']) > 0:
 
        reason = ('You have reached the maximum number of users (%s), '
 
                  'please contact support to extend your license.'
 
                  % license_info['users'])
 
        raise UserCreationError(reason)
 

	
 

	
 
def log_create_user(user_dict, created_by, **kwargs):
 
    """
rhodecode/model/license.py
Show inline comments
 
deleted file
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -45,8 +45,6 @@
 
          <li class="${'active' if c.active=='hooks' else ''}"><a href="${h.url('admin_settings_hooks')}">${_('Hooks')}</a></li>
 
          <li class="${'active' if c.active=='search' else ''}"><a href="${h.url('admin_settings_search')}">${_('Full text search')}</a></li>
 
          <li class="${'active' if c.active=='system' else ''}"><a href="${h.url('admin_settings_system')}">${_('System Info')}</a></li>
 
          <li class="${'active' if c.active=='license' else ''}"><a href="${h.url('admin_settings_license')}">${_('License')}</a></li>
 

	
 
        </ul>
 
    </div>
 

	
rhodecode/templates/admin/settings/settings_license.html
Show inline comments
 
deleted file
rhodecode/tests/models/test_license.py
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)