-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix permission bugs in team API #647
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
Conversation
) | ||
|
||
// ListTeams list all the teams of an organization | ||
func ListTeams(ctx *context.APIContext) { | ||
org := ctx.Org.Organization | ||
if !org.IsOrgMember(ctx.User.ID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends public or private status of org members. If public, then everyone could visit the members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you are saying; this is an endpoint for viewing an organization's teams, not for viewing the members of those teams.
Regardless, the corresponding endpoint in the Github API (GET /orgs/:orgname/teams
) is only accessible to organization members, so I believe that is what we want to do here
|
||
// GetTeamMembers api for get a team's members | ||
func GetTeamMembers(ctx *context.APIContext) { | ||
if !models.IsOrganizationMember(ctx.Org.Team.OrgID, ctx.User.ID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The corresponding Github endpoint (GET /teams/:id
) is only accessible to organization members (even if there are public members of the team), so I believe that is what we want to do here.
LGTM |
LGTM |
conflicted. |
LGTM |
Fixed |
3211e6e
to
8aa3d1d
Compare
Hello,
Actually, in v1.1.2, there is no API endpoint to replace them. If you didn't remove anything in the Maybe I should open a issue about that ? Have a nice day |
@theznx The |
@ethantkoenig Oh! Sorry for the inconvenience. |
Some endpoints unnecessarily required the authenticated user to be an admin (basically everything removed from
api/v1/admin/org_team.go
).Other endpoints didn't check that the authenticated user was an organization member.