diff --git a/README b/README index 448c532..cbaa6a1 100644 --- a/README +++ b/README @@ -64,98 +64,4 @@ local_settings.py file or in the environment. Name Description ================================ ============================================ TEMPLATE_VARS dictionnary of variables passed to templates -FAVICON_URL URL pointing to the favicon -WCSINST_DEFAULT_VARIABLES default value for WCSINST new instances -PROFILE_FORM_PLUGIN_FORM_CLASS form class to use instead of the default one - for editing user profile - -Migrating users from W.C.S. to portail-citoyen ----------------------------------------------- - -You must use the management command named load-wcs-users. You must first link -your W.C.S. instance to the portail-citoyen as a new SAML 2.0 service provider. -The command accept the following options:: - - - --provider= - - The name of the SAML 2.0 service provider in the portail citoyen configuratio. - This option is mandatory. - - --mapping=: - - Map a user field identifier from W.C.S. to a local user model field. This - option is mandatory. - - --extra= - - The path to a W.C.S. extra package to load (AuQuotidien for example). - - --verbose - - Display information logged on the console - - --debug - - display debugging information on the console - - --fake - - Launch a dry run, i.e. do not save new user and new federation - - --help-mapping - - Display the list of field available in the local user model and in the - W.C.S. user model - - --allow-not-mapped - - Do not fail when a W.C.S. user field is not mapped to a local user field - - -Importing role from W.C.S. into portail-citoyen ------------------------------------------------ - -Your must first decide on a prefix for naming roles on the portail-citoyen -side, default is 'AuQuo::'. Then federated roles must be actived and the -prefix be configured in the `site-options.cfg` file of the W.C.S. host -directory like this:: - - [options] - saml2_use_role = true - saml2_role_prefix = MyPrefix:: - -Then you can use the `load-wcs-roles` command which accept the following options:: - - --url= - - URL of the W.C.S. instance from which we want to import roles (mandatory) - - --prefix - - The chosen federated role name prefix (mandatory) - - --orig - - The web-service identifier configured in `site-options.cfg` (mandatory) - - --key - - The web-service signature secret configured in `site-options.cfg` (mandatory) - - --email - - The email of the admin user used to access the fole list (mandatory) - - --deleted-orphaned-roles - - If actived delete federation roles starting with the given prefix which - does not exist on W.C.S. side. - - --verbose - - Display logs on console - - --debug - - Display logs on console and set log level to DEBUG +PORTAIL_ADMIN_URL URL of the global administration portal diff --git a/portail_citoyen2/app_settings.py b/portail_citoyen2/app_settings.py index 440293f..8779707 100644 --- a/portail_citoyen2/app_settings.py +++ b/portail_citoyen2/app_settings.py @@ -3,7 +3,9 @@ import sys from django.core.exceptions import ImproperlyConfigured class AppSettings(object): - __defaults = {} + __defaults = { + 'PORTAIL_ADMIN_URL': None, + } def __init__(self, prefix): self.prefix = prefix diff --git a/portail_citoyen2/context_processors.py b/portail_citoyen2/context_processors.py index 79947dd..b363983 100644 --- a/portail_citoyen2/context_processors.py +++ b/portail_citoyen2/context_processors.py @@ -1,4 +1,7 @@ from . import app_settings def template_vars(request): - return app_settings.TEMPLATE_VARS + ctx = app_settings.TEMPLATE_VARS.copy() + if app_settings.PORTAIL_ADMIN_URL: + ctx['PORTAIL_ADMIN_URL'] = app_settings.PORTAIL_ADMIN_URL + return ctx diff --git a/portail_citoyen2/templates/admin/base_site.html b/portail_citoyen2/templates/admin/base_site.html new file mode 100644 index 0000000..2e858ab --- /dev/null +++ b/portail_citoyen2/templates/admin/base_site.html @@ -0,0 +1,29 @@ +{% extends "admin/base.html" %} +{% load i18n admin_tools_menu_tags %} + +{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %} + +{% block extrastyle %} +{{ block.super }} +{% if user.is_active and user.is_staff %} +{% if not is_popup %} +{% admin_tools_render_menu_css %} +{% endif %} +{% endif %} +{% endblock %} + +{% block branding %} +{% if PORTAIL_ADMIN_URL %} +

{% trans 'Administration portal' %}

+{% else %} +

{% trans 'Django administration' %}

+{% endif %} +{% endblock %} + +{% block nav-global %} +{% if user.is_active and user.is_staff %} +{% if not is_popup %} +{% admin_tools_render_menu %} +{% endif %} +{% endif %} +{% endblock %}