Access control: use uid for dashboard and folder scopes (#46807)
* use uid:s for folder and dashboard permissions * evaluate folder and dashboard permissions based on uids * add dashboard.uid to accept list * Check for exact suffix * Check parent folder on create * update test * drop dashboard:create actions with dashboard scope * fix typo * AccessControl: test id 0 scope conversion * AccessControl: store only parent folder UID * AccessControl: extract general as a constant * FolderServices: Prevent creation of a folder uid'd general * FolderServices: Test folder creation prevention * Update pkg/services/guardian/accesscontrol_guardian.go * FolderServices: fix mock call expect * FolderServices: remove uneeded mocks Co-authored-by: jguer <joao.guerreiro@grafana.com>
This commit is contained in:
@@ -108,7 +108,7 @@ func TestAccessControlDashboardPermissionFilter_Where(t *testing.T) {
|
||||
title: "folder and dashboard actions are defined",
|
||||
dashboardActions: []string{"test"},
|
||||
folderActions: []string{"test"},
|
||||
expectedResult: "((( 1 = 0 OR 1 = 0) AND NOT dashboard.is_folder) OR ( 1 = 0 AND dashboard.is_folder))",
|
||||
expectedResult: "((( 1 = 0 OR dashboard.folder_id IN(SELECT id FROM dashboard WHERE 1 = 0)) AND NOT dashboard.is_folder) OR ( 1 = 0 AND dashboard.is_folder))",
|
||||
},
|
||||
{
|
||||
title: "folder actions are defined but not dashboard actions",
|
||||
@@ -120,7 +120,7 @@ func TestAccessControlDashboardPermissionFilter_Where(t *testing.T) {
|
||||
title: "dashboard actions are defined but not folder actions",
|
||||
dashboardActions: []string{"test"},
|
||||
folderActions: nil,
|
||||
expectedResult: "((( 1 = 0 OR 1 = 0) AND NOT dashboard.is_folder))",
|
||||
expectedResult: "((( 1 = 0 OR dashboard.folder_id IN(SELECT id FROM dashboard WHERE 1 = 0)) AND NOT dashboard.is_folder))",
|
||||
},
|
||||
{
|
||||
title: "dashboard actions are defined but not folder actions",
|
||||
|
||||
Reference in New Issue
Block a user