UI : vocabulaire unifié, comptes + mots de passe, choix par élément, clé AES auto
This commit is contained in:
1 parent
ee8343c69f
commit
2ca2f87307
19 files changed
+377
-143
No files matched your search
@@ -151,3 +151,37 @@ func (p Plan) Digest() string {
|
||||
sum := sha256.Sum256(b)
|
||||
return hex.EncodeToString(sum[:12])
|
||||
}
|
||||
|
||||
// Skip removes from a plan the changes of the kinds left out of a replication
|
||||
// ("not synchronized" in the dry-run), then keeps what the remaining changes
|
||||
// need as Filter does: a group to create for an account stays in the plan.
|
||||
// keys narrows the plan to some objects first (empty: every object).
|
||||
func Skip(p Plan, keys []string, skip []model.Kind) Plan {
|
||||
if len(skip) == 0 {
|
||||
return Filter(p, keys)
|
||||
}
|
||||
out := map[model.Kind]bool{}
|
||||
for _, k := range skip {
|
||||
out[k] = true
|
||||
}
|
||||
if len(keys) == 0 {
|
||||
for _, c := range p.Changes {
|
||||
keys = append(keys, c.Key())
|
||||
}
|
||||
for _, e := range p.Errors {
|
||||
if k, ok := ErrorKey(e); ok {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
var kept []string
|
||||
for _, k := range keys {
|
||||
if kind, _, _ := strings.Cut(k, "/"); !out[model.Kind(kind)] {
|
||||
kept = append(kept, k)
|
||||
}
|
||||
}
|
||||
if len(kept) == 0 {
|
||||
return Plan{Client: p.Client, Warnings: p.Warnings}
|
||||
}
|
||||
return Filter(p, kept)
|
||||
}
|
||||
Reference in new issue
Block a user