# HG changeset patch # User Bradley M. Kuhn # Date 2014-07-03 01:05:47 # Node ID de26de99ac5bd85d8a33bc3a1f2a1ccd34565dc1 # Parent ad38f9f93b3b485e5907601b811d1a6130d50ff5 Rename auth_rhodecode to auth_internal diff --git a/kallithea/controllers/admin/auth_settings.py b/kallithea/controllers/admin/auth_settings.py --- a/kallithea/controllers/admin/auth_settings.py +++ b/kallithea/controllers/admin/auth_settings.py @@ -53,7 +53,7 @@ class AuthSettingsController(BaseControl def __load_defaults(self): c.available_plugins = [ - 'kallithea.lib.auth_modules.auth_rhodecode', + 'kallithea.lib.auth_modules.auth_internal', 'kallithea.lib.auth_modules.auth_container', 'kallithea.lib.auth_modules.auth_ldap', 'kallithea.lib.auth_modules.auth_crowd', @@ -65,7 +65,7 @@ class AuthSettingsController(BaseControl _defaults = {} # default plugins loaded formglobals = { - "auth_plugins": ["kallithea.lib.auth_modules.auth_rhodecode"] + "auth_plugins": ["kallithea.lib.auth_modules.auth_internal"] } formglobals.update(Setting.get_auth_settings()) formglobals["plugin_settings"] = {} diff --git a/kallithea/controllers/admin/my_account.py b/kallithea/controllers/admin/my_account.py --- a/kallithea/controllers/admin/my_account.py +++ b/kallithea/controllers/admin/my_account.py @@ -116,7 +116,7 @@ class MyAccountController(BaseController skip_attrs = ['admin', 'active', 'extern_type', 'extern_name', 'new_password', 'password_confirmation'] #TODO: plugin should define if username can be updated - if c.extern_type != "rhodecode": + if c.extern_type != "internal": # forbid updating username for external accounts skip_attrs.append('username') diff --git a/kallithea/controllers/admin/users.py b/kallithea/controllers/admin/users.py --- a/kallithea/controllers/admin/users.py +++ b/kallithea/controllers/admin/users.py @@ -40,7 +40,7 @@ from kallithea.lib.exceptions import Def from kallithea.lib import helpers as h from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator, \ AuthUser, generate_api_key -import kallithea.lib.auth_modules.auth_rhodecode +import kallithea.lib.auth_modules.auth_internal from kallithea.lib import auth_modules from kallithea.lib.base import BaseController, render from kallithea.model.api_key import ApiKeyModel @@ -121,7 +121,7 @@ class UsersController(BaseController): def create(self): """POST /users: Create a new item""" # url('users') - c.default_extern_type = auth_modules.auth_rhodecode.RhodeCodeAuthPlugin.name + c.default_extern_type = auth_modules.auth_internal.RhodeCodeAuthPlugin.name user_model = UserModel() user_form = UserForm()() try: @@ -151,7 +151,7 @@ class UsersController(BaseController): def new(self, format='html'): """GET /users/new: Form to create a new item""" # url('new_user') - c.default_extern_type = auth_modules.auth_rhodecode.RhodeCodeAuthPlugin.name + c.default_extern_type = auth_modules.auth_internal.RhodeCodeAuthPlugin.name return render('admin/users/user_add.html') def update(self, id): @@ -175,7 +175,7 @@ class UsersController(BaseController): form_result = _form.to_python(dict(request.POST)) skip_attrs = ['extern_type', 'extern_name'] #TODO: plugin should define if username can be updated - if c.extern_type != "rhodecode": + if c.extern_type != "internal": # forbid updating username for external accounts skip_attrs.append('username') diff --git a/kallithea/controllers/api/api.py b/kallithea/controllers/api/api.py --- a/kallithea/controllers/api/api.py +++ b/kallithea/controllers/api/api.py @@ -618,8 +618,8 @@ class ApiController(JSONRPCController): def create_user(self, apiuser, username, email, password=Optional(''), firstname=Optional(''), lastname=Optional(''), active=Optional(True), admin=Optional(False), - extern_name=Optional('rhodecode'), - extern_type=Optional('rhodecode')): + extern_name=Optional('internal'), + extern_type=Optional('internal')): """ Creates new user. Returns new user object. This command can be executed only using api_key belonging to user with admin rights. diff --git a/kallithea/lib/auth_modules/__init__.py b/kallithea/lib/auth_modules/__init__.py --- a/kallithea/lib/auth_modules/__init__.py +++ b/kallithea/lib/auth_modules/__init__.py @@ -305,7 +305,7 @@ class RhodeCodeExternalAuthPlugin(RhodeC def importplugin(plugin): """ Imports and returns the authentication plugin in the module named by plugin - (e.g., plugin='kallithea.lib.auth_modules.auth_rhodecode'). Returns the + (e.g., plugin='kallithea.lib.auth_modules.auth_internal'). Returns the RhodeCodeAuthPluginBase subclass on success, raises exceptions on failure. raises: diff --git a/kallithea/lib/auth_modules/auth_rhodecode.py b/kallithea/lib/auth_modules/auth_internal.py rename from kallithea/lib/auth_modules/auth_rhodecode.py rename to kallithea/lib/auth_modules/auth_internal.py --- a/kallithea/lib/auth_modules/auth_rhodecode.py +++ b/kallithea/lib/auth_modules/auth_internal.py @@ -12,7 +12,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.auth_modules.auth_rhodecode +kallithea.lib.auth_modules.auth_internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RhodeCode authentication plugin for built in internal auth @@ -39,7 +39,7 @@ class RhodeCodeAuthPlugin(auth_modules.R @hybrid_property def name(self): - return "rhodecode" + return "internal" def settings(self): return [] diff --git a/kallithea/lib/db_manage.py b/kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py +++ b/kallithea/lib/db_manage.py @@ -374,8 +374,8 @@ class DbManage(object): :param skip_existing: """ - for k, v, t in [('auth_plugins', 'kallithea.lib.auth_modules.auth_rhodecode', 'list'), - ('auth_rhodecode_enabled', 'True', 'bool')]: + for k, v, t in [('auth_plugins', 'kallithea.lib.auth_modules.auth_internal', 'list'), + ('auth_internal_enabled', 'True', 'bool')]: if skip_existing and Setting.get_by_name(k) != None: log.debug('Skipping option %s' % k) continue @@ -541,7 +541,7 @@ class DbManage(object): UserModel().create_or_update(username, password, email, firstname='RhodeCode', lastname='Admin', active=True, admin=admin, - extern_type="rhodecode") + extern_type="internal") def create_default_user(self): log.info('creating default user') diff --git a/kallithea/lib/dbmigrate/versions/016_version_2_0_0.py b/kallithea/lib/dbmigrate/versions/016_version_2_0_0.py --- a/kallithea/lib/dbmigrate/versions/016_version_2_0_0.py +++ b/kallithea/lib/dbmigrate/versions/016_version_2_0_0.py @@ -63,7 +63,7 @@ def fixups(models, _SESSION): usr.extern_name = ldap_dn usr.extern_type = 'ldap' else: - usr.extern_name = 'rhodecode' - usr.extern_type = 'rhodecode' + usr.extern_name = 'internal' + usr.extern_type = 'internal' _SESSION().add(usr) _SESSION().commit() diff --git a/kallithea/lib/dbmigrate/versions/018_version_2_0_0.py b/kallithea/lib/dbmigrate/versions/018_version_2_0_0.py --- a/kallithea/lib/dbmigrate/versions/018_version_2_0_0.py +++ b/kallithea/lib/dbmigrate/versions/018_version_2_0_0.py @@ -37,7 +37,7 @@ def downgrade(migrate_engine): def fixups(models, _SESSION): notify('Fixing default auth modules') - plugins = 'kallithea.lib.auth_modules.auth_rhodecode' + plugins = 'kallithea.lib.auth_modules.auth_internal' opts = [] ldap_enabled = str2bool(getattr( models.Setting.get_by_name('ldap_active'), @@ -47,7 +47,7 @@ def fixups(models, _SESSION): opts.append(('auth_ldap_enabled', 'True', 'bool')) opts.append(('auth_plugins', plugins, 'list'),) - opts.append(('auth_rhodecode_enabled', 'True', 'bool')) + opts.append(('auth_internal_enabled', 'True', 'bool')) for name, default, type_ in opts: setting = models.Setting.get_by_name(name) diff --git a/kallithea/lib/dbmigrate/versions/020_version_2_0_1.py b/kallithea/lib/dbmigrate/versions/020_version_2_0_1.py --- a/kallithea/lib/dbmigrate/versions/020_version_2_0_1.py +++ b/kallithea/lib/dbmigrate/versions/020_version_2_0_1.py @@ -36,10 +36,10 @@ def downgrade(migrate_engine): def fixups(models, _SESSION): - #fix all empty extern type users to default 'rhodecode' + #fix all empty extern type users to default 'internal' for usr in models.User.query().all(): if not usr.extern_name: - usr.extern_name = 'rhodecode' - usr.extern_type = 'rhodecode' + usr.extern_name = 'internal' + usr.extern_type = 'internal' _SESSION().add(usr) _SESSION().commit() diff --git a/kallithea/model/user.py b/kallithea/model/user.py --- a/kallithea/model/user.py +++ b/kallithea/model/user.py @@ -185,8 +185,8 @@ class UserModel(BaseModel): try: form_data['admin'] = False - form_data['extern_name'] = 'rhodecode' - form_data['extern_type'] = 'rhodecode' + form_data['extern_name'] = 'internal' + form_data['extern_type'] = 'internal' new_user = self.create(form_data) self.sa.add(new_user) diff --git a/kallithea/templates/admin/my_account/my_account_profile.html b/kallithea/templates/admin/my_account/my_account_profile.html --- a/kallithea/templates/admin/my_account/my_account_profile.html +++ b/kallithea/templates/admin/my_account/my_account_profile.html @@ -20,7 +20,7 @@ ${h.form(url('my_account'), method='post <% readonly = None %> <% disabled = "" %>
- %if c.extern_type != 'rhodecode': + %if c.extern_type != 'internal': <% readonly = "readonly" %> <% disabled = " disabled" %> ${_('Your user is in an external Source of Record; some details cannot be managed here')}. diff --git a/kallithea/templates/admin/users/user_edit_profile.html b/kallithea/templates/admin/users/user_edit_profile.html --- a/kallithea/templates/admin/users/user_edit_profile.html +++ b/kallithea/templates/admin/users/user_edit_profile.html @@ -20,7 +20,7 @@ ${h.form(url('update_user', id=c.user.us <% readonly = None %> <% disabled = "" %>
- %if c.extern_type != 'rhodecode': + %if c.extern_type != 'internal':
<% readonly = "readonly" %> <% disabled = " disabled" %> diff --git a/kallithea/tests/api/api_base.py b/kallithea/tests/api/api_base.py --- a/kallithea/tests/api/api_base.py +++ b/kallithea/tests/api/api_base.py @@ -618,7 +618,7 @@ class BaseTestApi(object): id_, params = _build_data(self.apikey, 'create_user', username=username, - email=email, extern_name='rhodecode') + email=email, extern_name='internal') response = api_call(self, params) usr = UserModel().get_by_username(username) diff --git a/kallithea/tests/fixture.py b/kallithea/tests/fixture.py --- a/kallithea/tests/fixture.py +++ b/kallithea/tests/fixture.py @@ -110,7 +110,7 @@ class Fixture(object): lastname='Test', active=True, admin=False, - extern_type='rhodecode', + extern_type='internal', extern_name=None ) defs.update(custom) diff --git a/kallithea/tests/functional/test_admin_auth_settings.py b/kallithea/tests/functional/test_admin_auth_settings.py --- a/kallithea/tests/functional/test_admin_auth_settings.py +++ b/kallithea/tests/functional/test_admin_auth_settings.py @@ -26,7 +26,7 @@ class TestAuthSettingsController(TestCon if ldap_lib_installed: raise SkipTest('skipping due to missing ldap lib') - params = self._enable_plugins('kallithea.lib.auth_modules.auth_rhodecode,kallithea.lib.auth_modules.auth_ldap') + params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': u'dc.example.com', 'auth_ldap_port': '999', 'auth_ldap_tls_kind': 'PLAIN', @@ -56,7 +56,7 @@ class TestAuthSettingsController(TestCon if ldap_lib_installed: raise SkipTest('skipping due to missing ldap lib') - params = self._enable_plugins('kallithea.lib.auth_modules.auth_rhodecode,kallithea.lib.auth_modules.auth_ldap') + params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': '', 'auth_ldap_port': 'i-should-be-number', # bad port num 'auth_ldap_tls_kind': 'PLAIN', @@ -83,7 +83,7 @@ class TestAuthSettingsController(TestCon if ldap_lib_installed: raise SkipTest('skipping due to missing ldap lib') - params = self._enable_plugins('kallithea.lib.auth_modules.auth_rhodecode,kallithea.lib.auth_modules.auth_ldap') + params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': 'Host', 'auth_ldap_port': '123', 'auth_ldap_tls_kind': 'PLAIN', diff --git a/kallithea/tests/functional/test_admin_users.py b/kallithea/tests/functional/test_admin_users.py --- a/kallithea/tests/functional/test_admin_users.py +++ b/kallithea/tests/functional/test_admin_users.py @@ -56,8 +56,8 @@ class TestAdminUsersController(TestContr 'firstname': name, 'active': True, 'lastname': lastname, - 'extern_name': 'rhodecode', - 'extern_type': 'rhodecode', + 'extern_name': 'internal', + 'extern_type': 'internal', 'email': email}) self.checkSessionFlash(response, '''Created user %s''' % (username)) @@ -124,7 +124,7 @@ class TestAdminUsersController(TestContr self.log_user() usr = fixture.create_user(self.test_user_1, password='qweqwe', email='testme@example.com', - extern_type='rhodecode', + extern_type='internal', extern_name=self.test_user_1, skip_if_exists=True) Session().commit() @@ -136,7 +136,7 @@ class TestAdminUsersController(TestContr params['emails'] = [attrs['email']] if name == 'extern_type': #cannot update this via form, expected value is original one - params['extern_type'] = "rhodecode" + params['extern_type'] = "internal" if name == 'extern_name': #cannot update this via form, expected value is original one params['extern_name'] = self.test_user_1 diff --git a/kallithea/tests/functional/test_my_account.py b/kallithea/tests/functional/test_my_account.py --- a/kallithea/tests/functional/test_my_account.py +++ b/kallithea/tests/functional/test_my_account.py @@ -109,7 +109,7 @@ class TestMyAccountController(TestContro def test_my_account_update(self, name, attrs): usr = fixture.create_user(self.test_user_1, password='qweqwe', email='testme@example.com', - extern_type='rhodecode', + extern_type='internal', extern_name=self.test_user_1, skip_if_exists=True) params = usr.get_api_data() # current user data @@ -118,7 +118,7 @@ class TestMyAccountController(TestContro params.update({'password_confirmation': ''}) params.update({'new_password': ''}) - params.update({'extern_type': 'rhodecode'}) + params.update({'extern_type': 'internal'}) params.update({'extern_name': self.test_user_1}) params.update(attrs) @@ -137,7 +137,7 @@ class TestMyAccountController(TestContro params['emails'] = [attrs['email']] if name == 'extern_type': #cannot update this via form, expected value is original one - params['extern_type'] = "rhodecode" + params['extern_type'] = "internal" if name == 'extern_name': #cannot update this via form, expected value is original one params['extern_name'] = str(user_id)