RemoveUser disabled all plugins of a user when the user is disabled.
(userID uint)
| 182 | |
| 183 | // RemoveUser disabled all plugins of a user when the user is disabled. |
| 184 | func (m *Manager) RemoveUser(userID uint) error { |
| 185 | for _, p := range m.plugins { |
| 186 | pluginConf, err := m.db.GetPluginConfByUserAndPath(userID, p.PluginInfo().ModulePath) |
| 187 | if err != nil { |
| 188 | return err |
| 189 | } |
| 190 | if pluginConf == nil { |
| 191 | continue |
| 192 | } |
| 193 | if pluginConf.Enabled { |
| 194 | inst, err := m.Instance(pluginConf.ID) |
| 195 | if err != nil { |
| 196 | continue |
| 197 | } |
| 198 | m.mutex.Lock() |
| 199 | err = inst.Disable() |
| 200 | m.mutex.Unlock() |
| 201 | if err != nil { |
| 202 | return err |
| 203 | } |
| 204 | } |
| 205 | delete(m.instances, pluginConf.ID) |
| 206 | } |
| 207 | return nil |
| 208 | } |
| 209 | |
| 210 | type pluginFileLoadError struct { |
| 211 | Filename string |