mirror of https://github.com/go-gitea/gitea.git
Remove direct user adding to organization members (#2641)
This commit is contained in:
parent
f42dbdbae5
commit
32ca299650
|
@ -274,7 +274,6 @@ enterred_invalid_password = Please ensure the that password you entered is corre
|
|||
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
|
||||
|
@ -1070,7 +1069,6 @@ org_name_helper = Great organization names are short and memorable.
|
|||
create_org = Create Organization
|
||||
repo_updated = Updated
|
||||
people = People
|
||||
invite_someone = Invite Someone
|
||||
teams = Teams
|
||||
lower_members = members
|
||||
lower_repositories = repositories
|
||||
|
|
|
@ -17,8 +17,6 @@ import (
|
|||
const (
|
||||
// tplMembers template for organization members page
|
||||
tplMembers base.TplName = "org/member/members"
|
||||
// tplMemberInvite template for orgnization invite page
|
||||
tplMemberInvite base.TplName = "org/member/invite"
|
||||
)
|
||||
|
||||
// Members render orgnization users page
|
||||
|
@ -94,41 +92,3 @@ func MembersAction(ctx *context.Context) {
|
|||
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)
|
||||
}
|
||||
|
|
|
@ -407,8 +407,6 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
|
||||
m.Route("/delete", "GET,POST", org.SettingsDelete)
|
||||
})
|
||||
|
||||
m.Route("/invitations/new", "GET,POST", org.Invitation)
|
||||
}, context.OrgAssignment(true, true))
|
||||
}, reqSignIn)
|
||||
// ***** END: Organization *****
|
||||
|
|
|
@ -52,11 +52,6 @@
|
|||
{{end}}
|
||||
{{end}}
|
||||
</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}}
|
||||
<div class="ui top attached header">
|
||||
|
|
|
@ -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" .}}
|
|
@ -3,12 +3,6 @@
|
|||
{{template "org/header" .}}
|
||||
<div class="ui container">
|
||||
{{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">
|
||||
{{range .Members}}
|
||||
|
|
Loading…
Reference in New Issue