mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: get embedded user with roles and permissions (#19813)
* feat: get user roles endpoint * add tests * fix test * get user with permission and roles with full user * frontend * type juggling * the hash slinging slasher * user reducer and action * make it happy * result * lint Co-authored-by: Lily Kuang <lily@preset.io>
This commit is contained in:
committed by
GitHub
parent
7657e42cff
commit
7f8279b4b3
@@ -37,6 +37,21 @@ class TestCurrentUserApi(SupersetTestCase):
|
||||
self.assertEqual(True, response["result"]["is_active"])
|
||||
self.assertEqual(False, response["result"]["is_anonymous"])
|
||||
|
||||
def test_get_me_with_roles(self):
|
||||
self.login(username="admin")
|
||||
|
||||
rv = self.client.get(meUri + "roles/")
|
||||
self.assertEqual(200, rv.status_code)
|
||||
response = json.loads(rv.data.decode("utf-8"))
|
||||
roles = list(response["result"]["roles"].keys())
|
||||
self.assertEqual("Admin", roles.pop())
|
||||
|
||||
@patch("superset.security.manager.g")
|
||||
def test_get_my_roles_anonymous(self, mock_g):
|
||||
mock_g.user = security_manager.get_anonymous_user
|
||||
rv = self.client.get(meUri + "roles/")
|
||||
self.assertEqual(401, rv.status_code)
|
||||
|
||||
def test_get_me_unauthorized(self):
|
||||
self.logout()
|
||||
rv = self.client.get(meUri)
|
||||
|
||||
Reference in New Issue
Block a user