mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 20:32:11 +00:00
#1692 api: admin list and create team under organization
This commit is contained in:
parent
60ae8ac3d2
commit
e6f927f61a
15 changed files with 100 additions and 18 deletions
|
@ -154,25 +154,11 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
|||
ctx.Data["PageIsOrgTeams"] = true
|
||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||
|
||||
// Validate permission level.
|
||||
var auth models.AccessMode
|
||||
switch form.Permission {
|
||||
case "read":
|
||||
auth = models.ACCESS_MODE_READ
|
||||
case "write":
|
||||
auth = models.ACCESS_MODE_WRITE
|
||||
case "admin":
|
||||
auth = models.ACCESS_MODE_ADMIN
|
||||
default:
|
||||
ctx.Error(401)
|
||||
return
|
||||
}
|
||||
|
||||
t := &models.Team{
|
||||
OrgID: ctx.Org.Organization.Id,
|
||||
Name: form.TeamName,
|
||||
Description: form.Description,
|
||||
Authorize: auth,
|
||||
Authorize: models.ParseAccessMode(form.Permission),
|
||||
}
|
||||
ctx.Data["Team"] = t
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue