Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API : teams query #1809

Closed
2 of 7 tasks
camlafit opened this issue May 25, 2017 · 5 comments · Fixed by #1811
Closed
2 of 7 tasks

API : teams query #1809

camlafit opened this issue May 25, 2017 · 5 comments · Fixed by #1811
Labels
modifies/api This PR adds API routes or modifies them type/bug
Milestone

Comments

@camlafit
Copy link
Contributor

  • Gitea version (or commit ref): master and 1.1.1
  • Git version:
  • Operating system: Debian Jessie
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Following url provided by api/v1/api.go, I've try to get teams informations and set members to team.
I've tried with 1.1.1 and master version on 386 arch

Query tested :

curl -H 'Authorization: token $TOKEN' -X GET "https://$GITEA_SERVER/api/v1/teams/"
curl -H 'Authorization: token $TOKEN' -X GET "https://$GITEA_SERVER/api/v1/teams/3"
curl -H 'Authorization: token $TOKEN' -X PUT "https://$GITEA_SERVER/api/v1/teams/3/members/$USERNAME"

1/ With first query log shown :

[Macaron] 2017-05-25 08:49:58: Started GET /api/v1/teams for 88.190.92.83
[Macaron] 2017-05-25 08:49:58: Completed /api/v1/teams 404 Not Found in 10.363091ms

Looks logical any endpoint looks defined, but get all teams should be a plus

2/ With second query log shown :

[Macaron] 2017-05-25 08:49:35: Started GET /api/v1/teams/3/ for IP
[Macaron] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:489 (0x433c0f)
        gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/usr/local/go/src/runtime/panic.go:63 (0x432abe)
        panicmem: panic(memoryError)
/usr/local/go/src/runtime/signal_unix.go:290 (0x44928f)
        sigpanic: panicmem()
/root/GO/src/code.gitea.io/gitea/routers/api/v1/api.go:155 (0x10616aa)
/usr/local/go/src/runtime/asm_amd64.s:514 (0x460ca8)
        call32: CALLFN(·call32, 32)
/usr/local/go/src/reflect/value.go:434 (0x4c344f)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/usr/local/go/src/reflect/value.go:302 (0x4c2a14)
        Value.Call: return v.call("Call", in)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x85dfdf)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x85d9aa)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x88aca2)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x88abc6)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/session/session.go:186 (0x8e2300)
/usr/local/go/src/runtime/asm_amd64.s:514 (0x460ca8)
        call32: CALLFN(·call32, 32)
/usr/local/go/src/reflect/value.go:434 (0x4c344f)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/usr/local/go/src/reflect/value.go:302 (0x4c2a14)
        Value.Call: return v.call("Call", in)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x85dfdf)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x85d9aa)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x88aca2)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x88abc6)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x89dd2b)
/usr/local/go/src/runtime/asm_amd64.s:514 (0x460ca8)
        call32: CALLFN(·call32, 32)
/usr/local/go/src/reflect/value.go:434 (0x4c344f)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/usr/local/go/src/reflect/value.go:302 (0x4c2a14)
        Value.Call: return v.call("Call", in)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x85dfdf)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x85d9aa)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x88aca2)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x88abc6)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/logger.go:43 (0x89cfe4)
/usr/local/go/src/runtime/asm_amd64.s:514 (0x460ca8)
        call32: CALLFN(·call32, 32)
/usr/local/go/src/reflect/value.go:434 (0x4c344f)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/usr/local/go/src/reflect/value.go:302 (0x4c2a14)
        Value.Call: return v.call("Call", in)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x85dfdf)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x85d9aa)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x88aca2)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:184 (0x89eff9)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:288 (0x8970dd)
/root/GO/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/macaron.go:177 (0x88f10c)
/root/GO/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0xaca22b)
/usr/local/go/src/net/http/server.go:1942 (0x6dba34)
        HandlerFunc.ServeHTTP: f(w, r)
/usr/local/go/src/net/http/server.go:2568 (0x6de2f2)
        serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1825 (0x6da5a2)
        (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm_amd64.s:2197 (0x463461)
        goexit: BYTE    $0x90   // NOP
[Macaron] 2017-05-25 08:51:48: Completed /api/v1/teams/3 500 Internal Server Error in 23.696434ms

3/ With third query

[Macaron] 2017-05-25 08:53:17: Started GET /api/v1/teams/3/members/$USERNAME for IP
[Macaron] 2017-05-25 08:53:17: Completed /api/v1/teams/3/members/$USERNAME 404 Not Found in 11.908173ms
@lunny lunny added modifies/api This PR adds API routes or modifies them type/bug labels May 25, 2017
@lunny lunny added this to the 1.2.0 milestone May 25, 2017
@ethantkoenig
Copy link
Member

@camlafit #1811 fixes the second query. The third query should return a 404 if $USERNAME is not an actual username, or if that user is not a member of the team (see https://developer.github.com/v3/orgs/teams/#get-team-member)

@camlafit
Copy link
Contributor Author

Hi

No more 500 on second query, but now 404

  • TOKEN is related an admin account (and is set in team)
  • USERNAME is an active account create by PUT admin/users api

Thirth query looks ok now, user is set to team.

User related to token is

  • listed on GET /api/v1/teams/3/members
  • 404 on GET /api/v1/teams/3/members/$USERNAME_TOKEN
  • 204 on PUT /api/v1/teams/3/members/$USERNAME_TOKEN

Username is

  • 204 on PUT /api/v1/teams/3/members/$USERNAME
  • 404 on GET /api/v1/teams/3/members/$USERNAME
  • listed on GET /api/v1/teams/3/members

@ethantkoenig
Copy link
Member

ethantkoenig commented May 26, 2017

@camlafit If the user authenticated by $TOKEN is not a member of whatever organization team 3 belongs to, then GET /api/v1/teams/3 should return a 404.

@camlafit
Copy link
Contributor Author

Hi

Ok understood, looks normal and this issue should be set as solved, but I've two others questions directly related :

  • Looks to miss GET /api/v1/teams/:teamid/members/$USERNAME , should be return data about this username
  • Looks to miss GET /api/v1/teams/ , should be return teams list affect to the user query

And about admin usage (get all teams, ...) , should be set in /api/v1/admin/ part

@lunny
Copy link
Member

lunny commented May 26, 2017

@camlafit maybe you can fire another issue or maybe there is already an issue to describe it.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants