From d256e2014a809056cb5bd7d78cf9ecb871ccf75e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 15 Nov 2019 15:08:56 -0600 Subject: [PATCH] Provide background color when first checking API session --- tailbone/api/auth.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tailbone/api/auth.py b/tailbone/api/auth.py index d85f2fb1..07c4464d 100644 --- a/tailbone/api/auth.py +++ b/tailbone/api/auth.py @@ -57,7 +57,16 @@ class AuthenticationView(APIView): if self.request.user: data = self.user_info(self.request.user) data['user']['is_root'] = self.request.is_root + data['permissions'] = list(self.request.tailbone_cached_permissions) + + # background color may be set per-request, by some apps + if hasattr(self.request, 'background_color') and self.request.background_color: + data['background_color'] = self.request.background_color + else: # otherwise we use the one from config + data['background_color'] = self.rattail_config.get( + 'tailbone', 'background_color') + return data @api