ExtSvcAuth: Assign roles locally (#78669)

* ExtSvcAuth: Assign roles locally

* Fix test

* HandlePluginStateChanged in the OrgID

* Remove Global from command

* Use AssignmentOrgID instead of OrgID

* Remove unecessary test case
This commit is contained in:
Gabriel MABILLE
2023-11-29 12:12:30 +01:00
committed by GitHub
parent 5a6ac44902
commit 72d32eed27
8 changed files with 44 additions and 119 deletions
@@ -458,7 +458,12 @@ func (*OAuth2ServiceImpl) handleRegistrationPermissions(registration *extsvcauth
// handlePluginStateChanged reset the client authorized grant_types according to the plugin state
func (s *OAuth2ServiceImpl) handlePluginStateChanged(ctx context.Context, event *pluginsettings.PluginStateChangedEvent) error {
s.logger.Info("Plugin state changed", "pluginId", event.PluginId, "enabled", event.Enabled)
s.logger.Debug("Plugin state changed", "pluginId", event.PluginId, "enabled", event.Enabled)
if event.OrgId != extsvcauth.TmpOrgID {
s.logger.Debug("External Service not tied to this organization", "OrgId", event.OrgId)
return nil
}
// Retrieve client associated to the plugin
client, err := s.sqlstore.GetExternalServiceByName(ctx, event.PluginId)