1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Remove direct user adding to organization members (#2641)

This commit is contained in:
Lauris BH 2017-10-15 05:24:24 +03:00 committed by Lunny Xiao
parent f42dbdbae5
commit 32ca299650
6 changed files with 0 additions and 77 deletions

View File

@ -274,7 +274,6 @@ enterred_invalid_password = Please ensure the that password you entered is corre
user_not_exist = The user does not exist. 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. 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_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_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 invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s
@ -1070,7 +1069,6 @@ org_name_helper = Great organization names are short and memorable.
create_org = Create Organization create_org = Create Organization
repo_updated = Updated repo_updated = Updated
people = People people = People
invite_someone = Invite Someone
teams = Teams teams = Teams
lower_members = members lower_members = members
lower_repositories = repositories lower_repositories = repositories

View File

@ -17,8 +17,6 @@ import (
const ( const (
// tplMembers template for organization members page // tplMembers template for organization members page
tplMembers base.TplName = "org/member/members" tplMembers base.TplName = "org/member/members"
// tplMemberInvite template for orgnization invite page
tplMemberInvite base.TplName = "org/member/invite"
) )
// Members render orgnization users page // Members render orgnization users page
@ -94,41 +92,3 @@ func MembersAction(ctx *context.Context) {
ctx.Redirect(setting.AppSubURL + "/") ctx.Redirect(setting.AppSubURL + "/")
} }
} }
// Invitation render organization invitation page
func Invitation(ctx *context.Context) {
org := ctx.Org.Organization
ctx.Data["Title"] = org.FullName
ctx.Data["PageIsOrgMembers"] = true
if ctx.Req.Method == "POST" {
uname := ctx.Query("uname")
u, err := models.GetUserByName(uname)
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
} else {
ctx.Handle(500, " GetUserByName", err)
}
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
}
log.Trace("New member added(%s): %s", org.Name, u.Name)
ctx.Redirect(ctx.Org.OrgLink + "/members")
return
}
ctx.HTML(200, tplMemberInvite)
}

View File

@ -407,8 +407,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Route("/delete", "GET,POST", org.SettingsDelete) m.Route("/delete", "GET,POST", org.SettingsDelete)
}) })
m.Route("/invitations/new", "GET,POST", org.Invitation)
}, context.OrgAssignment(true, true)) }, context.OrgAssignment(true, true))
}, reqSignIn) }, reqSignIn)
// ***** END: Organization ***** // ***** END: Organization *****

View File

@ -52,11 +52,6 @@
{{end}} {{end}}
{{end}} {{end}}
</div> </div>
{{if .IsOrganizationOwner}}
<div class="ui bottom attached segment">
<a class="ui blue small button" href="{{.OrgLink}}/invitations/new">{{.i18n.Tr "org.invite_someone"}}</a>
</div>
{{end}}
{{if .IsOrganizationMember}} {{if .IsOrganizationMember}}
<div class="ui top attached header"> <div class="ui top attached header">

View File

@ -1,22 +0,0 @@
{{template "base/head" .}}
<div class="organization invite">
{{template "org/header" .}}
<div class="ui container">
<div id="invite-box">
{{template "base/alert" .}}
<h2>{{.i18n.Tr "org.members.invite_desc" .Org.DisplayName}}</h2>
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="inline field ui left">
<div id="search-user-box" class="ui search">
<div class="ui input">
<input class="prompt" name="uname" placeholder="{{.i18n.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" autofocus required>
</div>
</div>
</div>
<button class="ui blue button">{{.i18n.Tr "org.members.invite_now"}}</button>
</form>
</div>
</div>
</div>
{{template "base/footer" .}}

View File

@ -3,12 +3,6 @@
{{template "org/header" .}} {{template "org/header" .}}
<div class="ui container"> <div class="ui container">
{{template "base/alert" .}} {{template "base/alert" .}}
{{if .IsOrganizationOwner}}
<div class="text right">
<a class="ui blue button" href="{{.OrgLink}}/invitations/new"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "org.invite_someone"}}</a>
</div>
<div class="ui divider"></div>
{{end}}
<div class="list"> <div class="list">
{{range .Members}} {{range .Members}}