##// END OF EJS Templates
admin: moved admin pyramid into apps.
marcink -
r1503:91b1464c default
parent child Browse files
Show More
@@ -19,7 +19,7 b''
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21
21
22 from rhodecode.admin.navigation import NavigationRegistry
22 from rhodecode.apps.admin.navigation import NavigationRegistry
23 from rhodecode.config.routing import ADMIN_PREFIX
23 from rhodecode.config.routing import ADMIN_PREFIX
24 from rhodecode.lib.utils2 import str2bool
24 from rhodecode.lib.utils2 import str2bool
25
25
1 NO CONTENT: file renamed from rhodecode/admin/interfaces.py to rhodecode/apps/admin/interfaces.py
NO CONTENT: file renamed from rhodecode/admin/interfaces.py to rhodecode/apps/admin/interfaces.py
@@ -25,7 +25,7 b' import collections'
25 from pylons import url
25 from pylons import url
26 from zope.interface import implementer
26 from zope.interface import implementer
27
27
28 from rhodecode.admin.interfaces import IAdminNavigationRegistry
28 from rhodecode.apps.admin.interfaces import IAdminNavigationRegistry
29 from rhodecode.lib.utils import get_registry
29 from rhodecode.lib.utils import get_registry
30 from rhodecode.translation import _
30 from rhodecode.translation import _
31
31
1 NO CONTENT: file renamed from rhodecode/admin/views/__init__.py to rhodecode/apps/admin/views/__init__.py
NO CONTENT: file renamed from rhodecode/admin/views/__init__.py to rhodecode/apps/admin/views/__init__.py
1 NO CONTENT: file renamed from rhodecode/admin/views/base.py to rhodecode/apps/admin/views/base.py
NO CONTENT: file renamed from rhodecode/admin/views/base.py to rhodecode/apps/admin/views/base.py
@@ -24,8 +24,8 b' import logging'
24 from pylons import tmpl_context as c
24 from pylons import tmpl_context as c
25 from pyramid.view import view_config
25 from pyramid.view import view_config
26
26
27 from rhodecode.admin.views.base import AdminSettingsView
27 from rhodecode.apps.admin.views.base import AdminSettingsView
28 from rhodecode.admin.navigation import navigation_list
28 from rhodecode.apps.admin.navigation import navigation_list
29 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
29 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
30 from rhodecode.lib.utils import read_opensource_licenses
30 from rhodecode.lib.utils import read_opensource_licenses
31
31
@@ -26,7 +26,8 b' from pyramid.httpexceptions import HTTPF'
26
26
27 from rhodecode.translation import _
27 from rhodecode.translation import _
28
28
29 from rhodecode.admin.views.base import AdminSettingsView
29 from rhodecode.apps.admin.views.base import AdminSettingsView
30 from rhodecode.apps.admin.navigation import navigation_list
30 from rhodecode.lib.auth import (
31 from rhodecode.lib.auth import (
31 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
32 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
32 from rhodecode.lib.utils2 import safe_int
33 from rhodecode.lib.utils2 import safe_int
@@ -34,9 +35,6 b' from rhodecode.lib import system_info'
34 from rhodecode.lib import user_sessions
35 from rhodecode.lib import user_sessions
35
36
36
37
37 from rhodecode.admin.navigation import navigation_list
38
39
40 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
41
39
42
40
@@ -24,7 +24,7 b' from pyramid.view import view_config'
24
24
25 from rhodecode.svn_support.utils import generate_mod_dav_svn_config
25 from rhodecode.svn_support.utils import generate_mod_dav_svn_config
26
26
27 from rhodecode.admin.views.base import AdminSettingsView
27 from rhodecode.apps.admin.views.base import AdminSettingsView
28 from rhodecode.lib.auth import (
28 from rhodecode.lib.auth import (
29 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
29 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
30
30
@@ -26,14 +26,13 b' from pylons import tmpl_context as c'
26 from pyramid.view import view_config
26 from pyramid.view import view_config
27
27
28 import rhodecode
28 import rhodecode
29 from rhodecode.apps.admin.views.base import AdminSettingsView
30 from rhodecode.apps.admin.navigation import navigation_list
29 from rhodecode.lib import helpers as h
31 from rhodecode.lib import helpers as h
30 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
32 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
31 from rhodecode.lib.utils2 import str2bool
33 from rhodecode.lib.utils2 import str2bool
32 from rhodecode.lib import system_info
34 from rhodecode.lib import system_info
33 from rhodecode.lib.ext_json import json
35 from rhodecode.lib.ext_json import json
34
35 from rhodecode.admin.views.base import AdminSettingsView
36 from rhodecode.admin.navigation import navigation_list
37 from rhodecode.model.settings import SettingsModel
36 from rhodecode.model.settings import SettingsModel
38
37
39 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
@@ -277,18 +277,20 b' def includeme(config):'
277 # Includes which are required. The application would fail without them.
277 # Includes which are required. The application would fail without them.
278 config.include('pyramid_mako')
278 config.include('pyramid_mako')
279 config.include('pyramid_beaker')
279 config.include('pyramid_beaker')
280
280 config.include('rhodecode.channelstream')
281 config.include('rhodecode.channelstream')
281 config.include('rhodecode.admin')
282 config.include('rhodecode.authentication')
282 config.include('rhodecode.authentication')
283 config.include('rhodecode.integrations')
283 config.include('rhodecode.integrations')
284
284
285 # apps
285 # apps
286 config.include('rhodecode.apps.admin')
286 config.include('rhodecode.apps.login')
287 config.include('rhodecode.apps.login')
287 config.include('rhodecode.apps.user_profile')
288 config.include('rhodecode.apps.user_profile')
288
289
289 config.include('rhodecode.tweens')
290 config.include('rhodecode.tweens')
290 config.include('rhodecode.api')
291 config.include('rhodecode.api')
291 config.include('rhodecode.svn_support')
292 config.include('rhodecode.svn_support')
293
292 config.add_route(
294 config.add_route(
293 'rhodecode_support', 'https://rhodecode.com/help/', static=True)
295 'rhodecode_support', 'https://rhodecode.com/help/', static=True)
294
296
@@ -36,7 +36,7 b' from pyramid.threadlocal import get_curr'
36 from webob.exc import HTTPBadRequest
36 from webob.exc import HTTPBadRequest
37
37
38 import rhodecode
38 import rhodecode
39 from rhodecode.admin.navigation import navigation_list
39 from rhodecode.apps.admin.navigation import navigation_list
40 from rhodecode.lib import auth
40 from rhodecode.lib import auth
41 from rhodecode.lib import helpers as h
41 from rhodecode.lib import helpers as h
42 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
42 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
@@ -29,6 +29,7 b' from pyramid.httpexceptions import HTTPF'
29 from pyramid.renderers import render
29 from pyramid.renderers import render
30 from pyramid.response import Response
30 from pyramid.response import Response
31
31
32 from rhodecode.apps.admin.navigation import navigation_list
32 from rhodecode.lib import auth
33 from rhodecode.lib import auth
33 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
34 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
34 from rhodecode.lib.utils2 import safe_int
35 from rhodecode.lib.utils2 import safe_int
@@ -36,7 +37,6 b' from rhodecode.lib.helpers import Page'
36 from rhodecode.model.db import Repository, RepoGroup, Session, Integration
37 from rhodecode.model.db import Repository, RepoGroup, Session, Integration
37 from rhodecode.model.scm import ScmModel
38 from rhodecode.model.scm import ScmModel
38 from rhodecode.model.integration import IntegrationModel
39 from rhodecode.model.integration import IntegrationModel
39 from rhodecode.admin.navigation import navigation_list
40 from rhodecode.translation import _
40 from rhodecode.translation import _
41 from rhodecode.integrations import integration_type_registry
41 from rhodecode.integrations import integration_type_registry
42 from rhodecode.model.validation_schema.schemas.integration_schema import (
42 from rhodecode.model.validation_schema.schemas.integration_schema import (
@@ -75,11 +75,10 b' class IntegrationSettingsViewBase(object'
75 repo_name = request.matchdict['repo_name']
75 repo_name = request.matchdict['repo_name']
76 self.repo = Repository.get_by_repo_name(repo_name)
76 self.repo = Repository.get_by_repo_name(repo_name)
77
77
78 if 'repo_group_name' in request.matchdict: # in group settings context
78 if 'repo_group_name' in request.matchdict: # in group settings context
79 repo_group_name = request.matchdict['repo_group_name']
79 repo_group_name = request.matchdict['repo_group_name']
80 self.repo_group = RepoGroup.get_by_group_name(repo_group_name)
80 self.repo_group = RepoGroup.get_by_group_name(repo_group_name)
81
81
82
83 if 'integration' in request.matchdict: # integration type context
82 if 'integration' in request.matchdict: # integration type context
84 integration_type = request.matchdict['integration']
83 integration_type = request.matchdict['integration']
85 self.IntegrationType = integration_type_registry[integration_type]
84 self.IntegrationType = integration_type_registry[integration_type]
@@ -380,12 +379,12 b' class GlobalIntegrationsView(Integration'
380
379
381 class RepoIntegrationsView(IntegrationSettingsViewBase):
380 class RepoIntegrationsView(IntegrationSettingsViewBase):
382 def perm_check(self, user):
381 def perm_check(self, user):
383 return auth.HasRepoPermissionAll('repository.admin'
382 return auth.HasRepoPermissionAll('repository.admin')(
384 )(repo_name=self.repo.repo_name, user=user)
383 repo_name=self.repo.repo_name, user=user)
385
384
386
385
387 class RepoGroupIntegrationsView(IntegrationSettingsViewBase):
386 class RepoGroupIntegrationsView(IntegrationSettingsViewBase):
388 def perm_check(self, user):
387 def perm_check(self, user):
389 return auth.HasRepoGroupPermissionAll('group.admin'
388 return auth.HasRepoGroupPermissionAll('group.admin')(
390 )(group_name=self.repo_group.group_name, user=user)
389 group_name=self.repo_group.group_name, user=user)
391
390
@@ -32,7 +32,7 b' from rhodecode.tests.utils import Assert'
32
32
33
33
34 UPDATE_DATA_QUALNAME = (
34 UPDATE_DATA_QUALNAME = (
35 'rhodecode.admin.views.system_info.AdminSystemInfoSettingsView.get_update_data')
35 'rhodecode.apps.admin.views.system_info.AdminSystemInfoSettingsView.get_update_data')
36
36
37
37
38 @pytest.mark.usefixtures('autologin_user', 'app')
38 @pytest.mark.usefixtures('autologin_user', 'app')
@@ -425,7 +425,7 b' class TestOpenSourceLicenses(object):'
425 }
425 }
426 }
426 }
427 read_licenses_patch = mock.patch(
427 read_licenses_patch = mock.patch(
428 'rhodecode.admin.views.open_source_licenses.read_opensource_licenses',
428 'rhodecode.apps.admin.views.open_source_licenses.read_opensource_licenses',
429 return_value=sample_licenses)
429 return_value=sample_licenses)
430 with read_licenses_patch:
430 with read_licenses_patch:
431 response = self.app.get(self._get_url(), status=200)
431 response = self.app.get(self._get_url(), status=200)
General Comments 0
You need to be logged in to leave comments. Login now