* FIX: Remove RBAC datasource permissions upon datasource deletion
* Use scope provider instead
* Fix test
(cherry picked from commit 7595ed0668)
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
1 parent
41a40e1b6c
commit
c4e6e05687
2 files changed
+2
-3
No files matched your search
@@ -121,7 +121,7 @@ func (ss *SQLStore) DeleteDataSource(ctx context.Context, cmd *datasources.Delet
|
||||
|
||||
// Remove associated AccessControl permissions
|
||||
if _, errDeletingPerms := sess.Exec("DELETE FROM permission WHERE scope=?",
|
||||
ac.Scope("datasources", "id", fmt.Sprint(dsQuery.Result.Id))); errDeletingPerms != nil {
|
||||
ac.Scope(datasources.ScopeProvider.GetResourceScope(dsQuery.Result.Uid))); errDeletingPerms != nil {
|
||||
return errDeletingPerms
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package sqlstore
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -305,7 +304,7 @@ func TestIntegrationDataAccess(t *testing.T) {
|
||||
_, err := sess.Table("permission").Insert(ac.Permission{
|
||||
RoleID: 1,
|
||||
Action: "datasources:read",
|
||||
Scope: ac.Scope("datasources", "id", fmt.Sprintf("%d", ds.Id)),
|
||||
Scope: datasources.ScopeProvider.GetResourceScope(ds.Uid),
|
||||
Updated: time.Now(),
|
||||
Created: time.Now(),
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user