Alerting: Annotation CanUse for receiver resource (#110839)
* add origin to receiver * populate origin of the receiver * set CanUse to false if origin is not Grafana * set provenance if origin is imported * set Grafana origin by default in conversion API * set canUse annotation * reject update\delete operations on resources with origin other than Grafana * fail to create with wrong origin
This commit is contained in:
@@ -608,6 +608,7 @@ func TestIntegrationAccessControl(t *testing.T) {
|
||||
// Set expected metadata.
|
||||
expectedWithMetadata := expected.Copy().(*v0alpha1.Receiver)
|
||||
expectedWithMetadata.SetInUse(0, nil)
|
||||
expectedWithMetadata.SetCanUse(true)
|
||||
if tc.canUpdate {
|
||||
expectedWithMetadata.SetAccessControl("canWrite")
|
||||
}
|
||||
@@ -1294,6 +1295,7 @@ func TestIntegrationCRUD(t *testing.T) {
|
||||
receiver.SetAccessControl("canReadSecrets")
|
||||
receiver.SetAccessControl("canAdmin")
|
||||
receiver.SetInUse(0, nil)
|
||||
receiver.SetCanUse(true)
|
||||
|
||||
// Use export endpoint because it's the only way to get decrypted secrets fast.
|
||||
cliCfg := helper.Org1.Admin.NewRestConfig()
|
||||
|
||||
Reference in New Issue
Block a user