Skip to content

Commit

Permalink
update (#7396)
Browse files Browse the repository at this point in the history
* update

* Update search_user.py
  • Loading branch information
r350178982 authored Jan 20, 2025
1 parent cc597b3 commit 2b6e052
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions seahub/api2/endpoints/admin/admin_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def post(self, request):
error_msg = 'role invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)

role = role.lower()
available_roles = get_available_admin_roles()
if role not in available_roles:
error_msg = 'role must be in %s.' % str(available_roles)
Expand Down Expand Up @@ -168,7 +167,6 @@ def put(self, request):
error_msg = 'role invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)

role = role.lower()
available_roles = get_available_admin_roles()
if role not in available_roles:
error_msg = 'role must be in %s.' % str(available_roles)
Expand Down
4 changes: 3 additions & 1 deletion seahub/api2/endpoints/search_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from seahub.settings import ENABLE_GLOBAL_ADDRESSBOOK, \
ENABLE_SEARCH_FROM_LDAP_DIRECTLY, ENABLE_SHOW_LOGIN_ID_WHEN_SEARCH_USER

from seahub.constants import GUEST_USER

logger = logging.getLogger(__name__)

try:
Expand Down Expand Up @@ -257,7 +259,7 @@ def search_user_when_global_address_book_disabled(request, q):
email_list = []
username = request.user.username
current_user = User.objects.get(email=username)
if current_user.role.lower() != 'guest':
if current_user.role != GUEST_USER:

if is_valid_email(q):

Expand Down

0 comments on commit 2b6e052

Please sign in to comment.