RBAC: Update permission query to not join on team table (#53677)
* RBAC: Add teamIDs to get permission query * RBAC: Remove join on team table and use team ids * RBAC: Pass team ids
This commit is contained in:
@@ -66,16 +66,6 @@ func TestAccessControlStore_GetUserPermissions(t *testing.T) {
|
||||
expected: 3,
|
||||
actions: []string{"dashboards:write"},
|
||||
},
|
||||
{
|
||||
desc: "Should return no permission when passing empty slice of actions",
|
||||
orgID: 1,
|
||||
role: "Viewer",
|
||||
userPermissions: []string{"1", "2", "10"},
|
||||
teamPermissions: []string{"100", "2"},
|
||||
builtinPermissions: []string{"5", "6"},
|
||||
expected: 0,
|
||||
actions: []string{},
|
||||
},
|
||||
{
|
||||
desc: "should only get br permissions for anonymous user",
|
||||
anonymousUser: true,
|
||||
@@ -131,14 +121,17 @@ func TestAccessControlStore_GetUserPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
userID := user.ID
|
||||
teamIDs := []int64{team.Id}
|
||||
if tt.anonymousUser {
|
||||
userID = 0
|
||||
teamIDs = []int64{}
|
||||
}
|
||||
permissions, err := store.GetUserPermissions(context.Background(), accesscontrol.GetUserPermissionsQuery{
|
||||
OrgID: tt.orgID,
|
||||
UserID: userID,
|
||||
Roles: roles,
|
||||
Actions: tt.actions,
|
||||
TeamIDs: teamIDs,
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user