MCPcopy Index your code
hub / github.com/kopia/kopia / run

Method run

cli/command_acl_enable.go:23–50  ·  view source on GitHub ↗
(ctx context.Context, rep repo.RepositoryWriter)

Source from the content-addressed store, hash-verified

21}
22
23func (c *commandACLEnable) run(ctx context.Context, rep repo.RepositoryWriter) error {
24 entries, err := acl.LoadEntries(ctx, rep, nil)
25 if err != nil {
26 return errors.Wrap(err, "error loading ACL entries")
27 }
28
29 if len(entries) != 0 && !c.reset {
30 return errors.New("ACLs already enabled")
31 }
32
33 if c.reset {
34 for _, e := range entries {
35 log(ctx).Infof("deleting previous ACL entry %v", e.ManifestID)
36
37 if err := rep.DeleteManifest(ctx, e.ManifestID); err != nil {
38 return errors.Wrap(err, "unable to delete previous ACL")
39 }
40 }
41 }
42
43 for _, e := range auth.DefaultACLs {
44 if err := acl.AddACL(ctx, rep, e, false); err != nil {
45 return errors.Wrap(err, "unable to add default ACL")
46 }
47 }
48
49 return nil
50}

Callers

nothing calls this directly

Calls 3

LoadEntriesFunction · 0.92
AddACLFunction · 0.92
DeleteManifestMethod · 0.65

Tested by

no test coverage detected