mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-27 16:04:50 -06:00
refac
This commit is contained in:
@@ -504,7 +504,7 @@ async def ldap_auth(
|
||||
user = Auths.authenticate_user_by_email(email, db=db)
|
||||
|
||||
if user:
|
||||
if user.role != 'admin' and ENABLE_LDAP_GROUP_MANAGEMENT and user_groups:
|
||||
if ENABLE_LDAP_GROUP_MANAGEMENT and user_groups:
|
||||
if ENABLE_LDAP_GROUP_CREATION:
|
||||
Groups.create_groups_by_group_names(user.id, user_groups, db=db)
|
||||
try:
|
||||
@@ -565,7 +565,7 @@ async def signin(
|
||||
)
|
||||
|
||||
user = Auths.authenticate_user_by_email(email, db=db)
|
||||
if WEBUI_AUTH_TRUSTED_GROUPS_HEADER and user and user.role != 'admin':
|
||||
if WEBUI_AUTH_TRUSTED_GROUPS_HEADER and user:
|
||||
group_names = request.headers.get(WEBUI_AUTH_TRUSTED_GROUPS_HEADER, '').split(',')
|
||||
group_names = [name.strip() for name in group_names if name.strip()]
|
||||
|
||||
|
||||
@@ -1508,7 +1508,7 @@ class OAuthManager:
|
||||
data={'id': user.id},
|
||||
expires_delta=parse_duration(auth_manager_config.JWT_EXPIRES_IN),
|
||||
)
|
||||
if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT and user.role != 'admin':
|
||||
if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT:
|
||||
self.update_user_groups(
|
||||
user=user,
|
||||
user_data=user_data,
|
||||
|
||||
Reference in New Issue
Block a user