Provide background color when first checking API session

This commit is contained in:
Lance Edgar 2019-11-15 15:08:56 -06:00
parent 0715bd6321
commit d256e2014a

View file

@ -57,7 +57,16 @@ class AuthenticationView(APIView):
if self.request.user: if self.request.user:
data = self.user_info(self.request.user) data = self.user_info(self.request.user)
data['user']['is_root'] = self.request.is_root data['user']['is_root'] = self.request.is_root
data['permissions'] = list(self.request.tailbone_cached_permissions) 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 return data
@api @api