From 5d281dc6ce3bcb2198a16e3799bfac17185b4651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 30 Nov 2017 15:30:08 +0100 Subject: [PATCH] Introduce 'has_subscription' role with 'can-renew-subscription' capability This is in preparation of presenting different messages to users, when their subscription should be renewed, or when they should buy a (new) subscription. --- cloud/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cloud/__init__.py b/cloud/__init__.py index 90666ab..d2e1367 100644 --- a/cloud/__init__.py +++ b/cloud/__init__.py @@ -12,8 +12,12 @@ ROLES_TO_BE_SUBSCRIBER = {'demo', 'subscriber', 'admin'} # TODO: get rid of thi class CloudExtension(PillarExtension): has_context_processor = True - user_roles = {'subscriber-pro'} - user_roles_indexable = {'subscriber-pro'} + user_roles = {'subscriber-pro', 'has_subscription'} + user_roles_indexable = {'subscriber-pro', 'has_subscription'} + + user_caps = { + 'has_subscription': {'can-renew-subscription'}, + } def __init__(self): self._log = logging.getLogger('%s.CloudExtension' % __name__)