Return new user permissions when logging in via API

This commit is contained in:
Lance Edgar 2020-02-21 12:36:11 -06:00
parent 5e028ce547
commit c96ab426a4

View file

@ -26,7 +26,7 @@ Tailbone Web API - Auth Views
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from rattail.db.auth import authenticate_user, set_user_password from rattail.db.auth import authenticate_user, set_user_password, cache_permissions
from tailbone.api import APIView, api from tailbone.api import APIView, api
from tailbone.db import Session from tailbone.db import Session
@ -84,6 +84,7 @@ class AuthenticationView(APIView):
return { return {
'ok': True, 'ok': True,
'user': self.get_user_info(user), 'user': self.get_user_info(user),
'permissions': list(cache_permissions(Session(), user)),
} }
def authenticate_user(self, username, password): def authenticate_user(self, username, password):