API /admin/users/{username} Edit an existing user is missing for allow_create_organization #2232

Closed
opened 2025-11-02 04:28:44 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @EnricoFerro on GitHub (Aug 22, 2018).

  • Gitea version (or commit ref): Actual ( Probably from d67b278a0d )
  • Git version:
  • Operating system:
  • Database (use [x]):
    • [ x] PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • [ x] Yes
    • No
    • Not relevant
  • Log gist:

Description

In the user setting is possible to set the creation of the organization from the flag "May Create Organizations"
image

The API EDIT USER /admin/users/{username} is missing of the flag allow_create_organization in the Model that simulate this flag

Changes

This is a ( probably incomplete ) list of the files to modify (Sorry I don't know Go... :-( )
File to modify:
6ca8fbd2f9/routers/api/v1/admin/user.go (L157)

adding lines:

if form.AllowCreateOrganization != nil {
u.AllowCreateOrganization = *form.AllowCreateOrganization
}


6ca8fbd2f9/templates/swagger/v1_json.tmpl (L6503)

adding lines:

"allow_create_organization": {
"type": "boolean",
"x-go-name": "AllowCreateOrganization"
},

Originally created by @EnricoFerro on GitHub (Aug 22, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): Actual ( Probably from d67b278a0d05e122bf510ac52bfbd69eab4f654d ) - Git version: - Operating system: - Database (use `[x]`): - [ x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ x] Yes - [ ] No - [ ] Not relevant - Log gist: ## Description In the user setting is possible to set the creation of the organization from the flag "**May Create Organizations**" ![image](https://user-images.githubusercontent.com/25525316/44454473-f1fc0580-a5fb-11e8-9c5a-17a0174ddc27.png) The [API EDIT USER /admin/users/{username}](https://try.gitea.io/api/swagger#/admin/adminEditUser) is missing of the flag **allow_create_organization** in the [Model](https://try.gitea.io/api/swagger#model-EditUserOption) that simulate this flag ### Changes This is a ( probably incomplete ) list of the files to modify (Sorry I don't know Go... :-( ) File to modify: https://github.com/go-gitea/gitea/blob/6ca8fbd2f94a1a02e1776a1d62ad2fb897839e47/routers/api/v1/admin/user.go#L157 adding lines: `if form.AllowCreateOrganization != nil {` ` u.AllowCreateOrganization = *form.AllowCreateOrganization` `}` --- https://github.com/go-gitea/gitea/blob/6ca8fbd2f94a1a02e1776a1d62ad2fb897839e47/templates/swagger/v1_json.tmpl#L6503 adding lines: `"allow_create_organization": {` ` "type": "boolean",` ` "x-go-name": "AllowCreateOrganization"` ` },`
GiteaMirror added the type/enhancementmodifies/api labels 2025-11-02 04:28:45 -06:00
Author
Owner

@daviian commented on GitHub (Aug 22, 2018):

I think we should also discuss aligning the API models for user creation and editing? Or am I missing a detail why these are different in the first place?

@daviian commented on GitHub (Aug 22, 2018): I think we should also discuss aligning the API models for user creation and editing? Or am I missing a detail why these are different in the first place?
Author
Owner

@EnricoFerro commented on GitHub (Aug 22, 2018):

For the creation and edit there are a lot of difference in the frontend.
I agree in an a scenario of FULL Rest API the creation is missing of a lot of information.

In the actual scenario the API follow the frontend ( without the : May Create Organization and Disable Sign-In )
Creation: API have more field than the frontend
Edit: is missing for the API prohibit_login and allow_create_organization

CREATION:

Field Type Mapping ( Frontend )
email string Email Address
full_name string ( Not present )
login_name string ???
password* string Password
send_notify boolean Send User Registration
source_id integer($int64) Authentication Source
username* string Username

EDIT:

Field Type Mapping ( Frontend )
active boolean User Account Is Activated
admin boolean Is Administrator
allow_git_hook boolean May Create Git Hooks
allow_import_local boolean May Import Local Repository
email* string($email) Email Address
full_name string Full Name
location string Location
login_name string ???
max_repo_creation integer($int64) Maximal Number of Repositories
password string Password
source_id integer($int64) Authentication Source
website string Website
prohibit_login boolean Disable Sign-In
allow_create_organization boolean Is Administrator
@EnricoFerro commented on GitHub (Aug 22, 2018): For the creation and edit there are a lot of difference in the frontend. I agree in an a scenario of FULL Rest API the creation is missing of a lot of information. In the actual scenario the API follow the frontend ( without the : _**May Create Organization**_ and **_Disable Sign-In_** ) **Creation**: API have more field than the frontend **Edit**: is missing for the API **prohibit_login** and **allow_create_organization** **CREATION**: Field | Type | Mapping ( Frontend ) -- | -- | -- email | string | Email Address full_name | string | ~~( Not present )~~ login_name | string | ??? password* | string | Password send_notify | boolean | Send User Registration source_id | integer($int64) | Authentication Source username* | string | Username **EDIT:** Field | Type | Mapping ( Frontend ) -- | -- | -- active | boolean | User Account Is Activated admin | boolean | Is Administrator allow_git_hook | boolean | May Create Git Hooks allow_import_local | boolean | May Import Local Repository email* | string($email) | Email Address full_name | string | Full Name location | string | Location login_name | string | **???** max_repo_creation | integer($int64) | Maximal Number of Repositories password | string | Password source_id | integer($int64) | Authentication Source website | string | Website ~~prohibit_login~~ | ~~boolean~~ | ~~Disable Sign-In~~ ~~allow_create_organization~~ | ~~boolean~~ | ~~Is Administrator~~
Author
Owner

@EnricoFerro commented on GitHub (Aug 23, 2018):

Create a Pull request #4774 that implement this Isssue
Create a Pull request #4775 that implement this Isssue

@EnricoFerro commented on GitHub (Aug 23, 2018): ~~Create a Pull request #4774 that implement this Isssue~~ Create a Pull request #4775 that implement this Isssue
Author
Owner

@EnricoFerro commented on GitHub (Aug 24, 2018):

#4775 Merged.

@EnricoFerro commented on GitHub (Aug 24, 2018): #4775 Merged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2232