Esempio n. 1
0
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)
}
Esempio n. 2
0
File: org.go Progetto: 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)
}
Esempio n. 3
0
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)
}