mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
RBAC: Fix delete team permissions on team delete (#83442)
* RBAC: Remove team permissions on delete * Remove unecessary deletes from store function * Nit on mock * Add test to the database * Nit on comment * Add another test to check that other permissions remain
This commit is contained in:
@@ -41,6 +41,10 @@ func (f FakeService) DeleteUserPermissions(ctx context.Context, orgID, userID in
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
func (f FakeService) DeleteTeamPermissions(ctx context.Context, orgID, teamID int64) error {
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
func (f FakeService) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error {
|
||||
return f.ExpectedErr
|
||||
}
|
||||
@@ -94,6 +98,10 @@ func (f FakeStore) DeleteUserPermissions(ctx context.Context, orgID, userID int6
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
func (f FakeStore) DeleteTeamPermissions(ctx context.Context, orgID, teamID int64) error {
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
func (f FakeStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error {
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
@@ -51,6 +51,24 @@ func (_m *MockStore) DeleteUserPermissions(ctx context.Context, orgID int64, use
|
||||
return r0
|
||||
}
|
||||
|
||||
// DeleteTeamPermissions provides a mock function with given fields: ctx, orgID, teamID
|
||||
func (_m *MockStore) DeleteTeamPermissions(ctx context.Context, orgID int64, teamID int64) error {
|
||||
ret := _m.Called(ctx, orgID, teamID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for DeleteTeamPermissions")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
|
||||
r0 = rf(ctx, orgID, teamID)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// GetUserPermissions provides a mock function with given fields: ctx, query
|
||||
func (_m *MockStore) GetUserPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error) {
|
||||
ret := _m.Called(ctx, query)
|
||||
|
||||
Reference in New Issue
Block a user