Skip to content

fix bug to deny to add orgnization as a member of an orgnization or team #1815

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

Merged
merged 1 commit into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ enterred_invalid_owner_name = Please ensure that the owner name you entered is c
enterred_invalid_password = Please ensure the that password you entered is correct.
user_not_exist = The user does not exist.
last_org_owner = Removing the last user from the owner team is not allowed because there must always be at least one owner in any given organization.
cannot_add_org_to_team = Organization cannot be added as a team member.
cannot_invite_org_to_org = Organization cannot be invited as an organization member.

invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s
invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s
Expand Down
6 changes: 6 additions & 0 deletions routers/org/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ func Invitation(ctx *context.Context) {
return
}

if u.IsOrganization() {
ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org"))
ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
return
}

if err = org.AddMember(u.ID); err != nil {
ctx.Handle(500, " AddMember", err)
return
Expand Down
6 changes: 6 additions & 0 deletions routers/org/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ func TeamsAction(ctx *context.Context) {
return
}

if u.IsOrganization() {
ctx.Flash.Error(ctx.Tr("form.cannot_add_org_to_team"))
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName)
return
}

err = ctx.Org.Team.AddMember(u.ID)
page = "team"
}
Expand Down