From b4950815a54039210d464a5e24425f745738ef31 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Wed, 12 Nov 2014 12:45:37 +0000 Subject: [PATCH] Added systemuser actions --- orchestra/admin/dashboard.py | 2 +- orchestra/apps/miscellaneous/settings.py | 5 +++++ orchestra/apps/systemusers/actions.py | 28 ++++++++++++++++++++++++ orchestra/conf/base_settings.py | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 orchestra/apps/miscellaneous/settings.py create mode 100644 orchestra/apps/systemusers/actions.py diff --git a/orchestra/admin/dashboard.py b/orchestra/admin/dashboard.py index fa6afc23..722f2511 100644 --- a/orchestra/admin/dashboard.py +++ b/orchestra/admin/dashboard.py @@ -12,7 +12,7 @@ def generate_services_group(): settings.FLUENT_DASHBOARD_APP_GROUPS += ( ('Services', { 'models': models, - 'collapsible': True + 'collapsible': True, }), ) diff --git a/orchestra/apps/miscellaneous/settings.py b/orchestra/apps/miscellaneous/settings.py new file mode 100644 index 00000000..429d07e4 --- /dev/null +++ b/orchestra/apps/miscellaneous/settings.py @@ -0,0 +1,5 @@ +from django.conf import settings + + +MISCELLANEOUS_IDENTIFIER_VALIDATORS = getattr(settings, MISCELLANEOUS_IDENTIFIER_VALIDATORS, {}) +# MISCELLANEOUS_IDENTIFIER_VALIDATORS = { miscservice__name: validator_function } diff --git a/orchestra/apps/systemusers/actions.py b/orchestra/apps/systemusers/actions.py new file mode 100644 index 00000000..a938e16a --- /dev/null +++ b/orchestra/apps/systemusers/actions.py @@ -0,0 +1,28 @@ +from functools import partial + +from django import forms +from django.contrib import messages +from django.db import transaction +from django.shortcuts import render +from django.utils.safestring import mark_safe +from django.utils.text import capfirst +from django.utils.translation import ungettext, ugettext_lazy as _ + +from orchestra.admin.decorators import action_with_confirmation +from orchestra.admin.utils import change_url + + +class GrantPermissionForm(forms.Form): + base_path = forms.ChoiceField(label=_("Grant access to"), choices=(('hola', 'hola'),), + help_text=_("User will be granted access to this directory.")) + path_extension = forms.CharField(label='', required=False) + read_only = forms.BooleanField(label=_("Read only"), initial=False, required=False, + help_text=_("Designates whether the permissions granted will be read-only or read/write.")) + + +@action_with_confirmation(extra_context=dict(form=GrantPermissionForm())) +def grant_permission(modeladmin, request, queryset): + # TODO + pass +grant_permission.url_name = 'grant-permission' +grant_permission.verbose_name = _("Grant permission") diff --git a/orchestra/conf/base_settings.py b/orchestra/conf/base_settings.py index 674b4999..44698c50 100644 --- a/orchestra/conf/base_settings.py +++ b/orchestra/conf/base_settings.py @@ -65,6 +65,7 @@ TEMPLATE_CONTEXT_PROCESSORS =( INSTALLED_APPS = ( # django-orchestra apps + 'orchestra', 'orchestra.apps.accounts', 'orchestra.apps.contacts',