MCPcopy
hub / github.com/dgraph-io/dgraph / info

Function info

acl/acl.go:630–656  ·  view source on GitHub ↗
(conf *viper.Viper)

Source from the content-addressed store, hash-verified

628}
629
630func info(conf *viper.Viper) error {
631 userId, groupId, err := getUserAndGroup(conf)
632 if err != nil {
633 return err
634 }
635
636 dc, cancel, err := getClientWithAdminCtx(conf)
637 if err != nil {
638 return fmt.Errorf("unable to get admin context: %w", err)
639 }
640 defer cancel()
641
642 ctx, ctxCancel := context.WithTimeout(context.Background(), 10*time.Second)
643 defer ctxCancel()
644 txn := dc.NewTxn()
645 defer func() {
646 if err := txn.Discard(ctx); err != nil {
647 fmt.Printf("Unable to discard transaction: %v\n", err)
648 }
649 }()
650
651 if len(userId) != 0 {
652 return queryAndPrintUser(ctx, txn, userId)
653 }
654
655 return queryAndPrintGroup(ctx, txn, groupId)
656}

Callers 1

initSubcommandsFunction · 0.85

Calls 5

getUserAndGroupFunction · 0.85
getClientWithAdminCtxFunction · 0.85
queryAndPrintUserFunction · 0.85
queryAndPrintGroupFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected