1717 StudyPrivateError ,
1818)
1919from core .formatting import _str_to_bool
20- from database .users import User , UserGroup
20+ from database .users import User
2121from routers .dependencies import expdb_connection , fetch_user
2222from schemas .core import Visibility
2323from schemas .study import CreateStudy , Study , StudyStatus , StudyType
@@ -44,7 +44,7 @@ async def _get_study_raise_otherwise(
4444 if user is None :
4545 msg = "Must authenticate for private study."
4646 raise AuthenticationRequiredError (msg )
47- if study .creator != user .user_id and UserGroup . ADMIN not in await user .get_groups ():
47+ if study .creator != user .user_id and not await user .is_admin ():
4848 msg = "Study is private."
4949 raise StudyPrivateError (msg )
5050 if _str_to_bool (study .legacy ):
@@ -71,7 +71,7 @@ async def attach_to_study(
7171 raise AuthenticationRequiredError (msg )
7272 study = await _get_study_raise_otherwise (study_id , user , expdb )
7373 # PHP lets *anyone* edit *any* study. We're not going to do that.
74- if study .creator != user .user_id and UserGroup . ADMIN not in await user .get_groups ():
74+ if study .creator != user .user_id and not await user .is_admin ():
7575 msg = f"Study { study_id } can only be edited by its creator."
7676 raise StudyNotEditableError (msg )
7777 if study .status != StudyStatus .IN_PREPARATION :
0 commit comments