MM-10121: CLI command to reset permissions system to default state. (#8637)
* MM-10121: CLI command to reset permissions system to default state. * Review comment.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a1882d4004
Коммит
b13a228b04
@@ -174,3 +174,13 @@ func (s *SqlSupplier) RoleGetByNames(ctx context.Context, names []string, hints
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *SqlSupplier) RolePermanentDeleteAll(ctx context.Context, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult {
|
||||
result := store.NewSupplierResult()
|
||||
|
||||
if _, err := s.GetMaster().Exec("DELETE FROM Roles"); err != nil {
|
||||
result.Err = model.NewAppError("SqlRoleStore.PermanentDeleteAll", "store.sql_role.permanent_delete_all.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -85,3 +85,14 @@ func (s SqlSystemStore) GetByName(name string) store.StoreChannel {
|
||||
result.Data = &system
|
||||
})
|
||||
}
|
||||
|
||||
func (s SqlSystemStore) PermanentDeleteByName(name string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
var system model.System
|
||||
if _, err := s.GetReplica().Exec("DELETE FROM Systems WHERE Name = :Name", map[string]interface{}{"Name": name}); err != nil {
|
||||
result.Err = model.NewAppError("SqlSystemStore.PermanentDeleteByName", "store.sql_system.permanent_delete_by_name.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
result.Data = &system
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user