示例#1
0
文件: team.go 项目: gigforks/gogs
func RemoveOrganizationUser(ctx *context.APIContext) {

	u := user.GetUserByParamsName(ctx, ":user")

	if ctx.Written() {
		return
	}

	org := user.GetUserByParamsName(ctx, ":orgname")

	if ctx.Written() {
		return
	}

	err := models.RemoveOrgUser(org.Id, u.Id)

	if err != nil {
		ctx.Error(500, "", err)
	}
	ctx.Status(204)
}
示例#2
0
文件: org.go 项目: gigforks/gogs
func DeleteOrg(ctx *context.APIContext) {
	org := user.GetUserByParamsName(ctx, ":orgname")

	if ctx.Written() {
		return
	}

	err := models.DeleteOrganization(org)

	if err != nil {
		ctx.Error(500, "", err)
	}
	ctx.Status(204)
}
示例#3
0
文件: team.go 项目: gigforks/gogs
func AddOrganizationUser(ctx *context.APIContext, form api.AddUserOption) {
	u, err := models.GetUserByName(form.UserName)

	if err != nil {
		ctx.Error(404, "user does not exist", err)
		return
	}

	org := user.GetUserByParamsName(ctx, ":orgname")
	err = models.AddOrgUser(org.Id, u.Id)

	if ctx.Written() {
		return
	}
	if err != nil {
		ctx.Error(500, "", err)
	}
	ctx.Status(201)
}