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

Method LoginIntoNamespace

dgraphapi/cluster.go:138–166  ·  view source on GitHub ↗
(user, password string, ns uint64)

Source from the content-addressed store, hash-verified

136}
137
138func (hc *HTTPClient) LoginIntoNamespace(user, password string, ns uint64) error {
139 // This is useful for v20.11 which does not support multi-tenancy
140 if ns == 0 {
141 return hc.LoginIntoNamespaceV20(user, password)
142 }
143
144 q := `mutation login($userId: String, $password: String, $namespace: Int) {
145 login(userId: $userId, password: $password, namespace: $namespace) {
146 response {
147 accessJWT
148 refreshJWT
149 }
150 }
151 }`
152 params := GraphQLParams{
153 Query: q,
154 Variables: map[string]interface{}{
155 "userId": user,
156 "password": password,
157 "namespace": ns,
158 },
159 }
160
161 hc.HttpToken = &HttpToken{
162 UserId: user,
163 Password: password,
164 }
165 return hc.doLogin(params, true)
166}
167
168func (hc *HTTPClient) LoginIntoNamespaceV20(user, password string) error {
169 q := `mutation login($userId: String, $password: String) {

Callers 15

checkUpgradeFunction · 0.80
TestCheckUpgradeFunction · 0.80
TestQueryDuplicateNodesFunction · 0.80
TestNamespacesFunction · 0.80
TestDropAllFunction · 0.80
TestDropDataFunction · 0.80
TestDropPredicateFunction · 0.80
TestDropTypeFunction · 0.80
TestMainFunction · 0.80
TestDrainingModeFunction · 0.80

Calls 2

LoginIntoNamespaceV20Method · 0.95
doLoginMethod · 0.95

Tested by 15

TestCheckUpgradeFunction · 0.64
TestQueryDuplicateNodesFunction · 0.64
TestNamespacesFunction · 0.64
TestDropAllFunction · 0.64
TestDropDataFunction · 0.64
TestDropPredicateFunction · 0.64
TestDropTypeFunction · 0.64
TestMainFunction · 0.64
TestDrainingModeFunction · 0.64
TestShortestPathFunction · 0.64