diff --git a/base/context_processors.py b/base/context_processors.py index 4c9d4b6b89..08e2f2c8a6 100644 --- a/base/context_processors.py +++ b/base/context_processors.py @@ -16,6 +16,6 @@ def base(request): return { 'seafile_version': settings.SEAFILE_VERSION, 'seahub_title': settings.SEAHUB_TITLE, - 'account_type': settings.ACCOUNT_TYPE, + # 'account_type': settings.ACCOUNT_TYPE, } diff --git a/organizations/middleware.py b/organizations/middleware.py index d7f0450b1d..3e74c1e7ff 100644 --- a/organizations/middleware.py +++ b/organizations/middleware.py @@ -4,7 +4,11 @@ from django.http import HttpResponseRedirect from seaserv import get_org_by_url_prefix, get_orgs_by_user from settings import ORG_CACHE_PREFIX - +try: + from seahub.settings import USE_ORG +except ImportError: + USE_ORG = False + class OrganizationMiddleware(object): """ Middleware that add organization info to request when user in organization @@ -12,13 +16,20 @@ class OrganizationMiddleware(object): """ def process_request(self, request): - # Get current org context - org = cache.get(ORG_CACHE_PREFIX + request.user.username) - request.user.org = org + if USE_ORG: + request.use_org = True + + # Get current org context + org = cache.get(ORG_CACHE_PREFIX + request.user.username) + request.user.org = org - # Get all orgs user created. - orgs = get_orgs_by_user(request.user.username) - request.user.orgs = orgs + # Get all orgs user created. + orgs = get_orgs_by_user(request.user.username) + request.user.orgs = orgs + else: + request.use_org = False + request.user.org = None + request.user.orgs = None return None diff --git a/settings.py b/settings.py index c0061ddd1a..86b133f185 100644 --- a/settings.py +++ b/settings.py @@ -208,7 +208,6 @@ CCNET_APPLET_ROOT = "http://localhost:13420" SEAHUB_TITLE = 'SeaHub' USE_SUBDOMAIN = False -ACCOUNT_TYPE = 'personal' # Replace this with your Crocodoc.com api token CROCODOC_API_TOKEN = '' diff --git a/templates/admin_base.html b/templates/admin_base.html index d859dfac16..301373701a 100644 --- a/templates/admin_base.html +++ b/templates/admin_base.html @@ -12,9 +12,11 @@