Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d0e1d7ce
"test/vscode:/vscode.git/clone" did not exist on "454418d2a6da6ebd5ad85e9d4b1c09ea69531ed7"
Unverified
Commit
d0e1d7ce
authored
Jan 06, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 06, 2024
Browse files
Merge pull request #401 from ollama-webui/edit-user
fix: update role
parents
e9753b87
e441875a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
backend/apps/web/routers/users.py
backend/apps/web/routers/users.py
+24
-0
No files found.
backend/apps/web/routers/users.py
View file @
d0e1d7ce
...
@@ -31,6 +31,30 @@ async def get_users(skip: int = 0, limit: int = 50, user=Depends(get_current_use
...
@@ -31,6 +31,30 @@ async def get_users(skip: int = 0, limit: int = 50, user=Depends(get_current_use
return
Users
.
get_users
(
skip
,
limit
)
return
Users
.
get_users
(
skip
,
limit
)
############################
# UpdateUserRole
############################
@
router
.
post
(
"/update/role"
,
response_model
=
Optional
[
UserModel
])
async
def
update_user_role
(
form_data
:
UserRoleUpdateForm
,
user
=
Depends
(
get_current_user
)
):
if
user
.
role
!=
"admin"
:
raise
HTTPException
(
status_code
=
status
.
HTTP_403_FORBIDDEN
,
detail
=
ERROR_MESSAGES
.
ACCESS_PROHIBITED
,
)
if
user
.
id
!=
form_data
.
id
:
return
Users
.
update_user_role_by_id
(
form_data
.
id
,
form_data
.
role
)
else
:
raise
HTTPException
(
status_code
=
status
.
HTTP_403_FORBIDDEN
,
detail
=
ERROR_MESSAGES
.
ACTION_PROHIBITED
,
)
############################
############################
# UpdateUserById
# UpdateUserById
############################
############################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment