fix: re-apply public elements fix

This commit is contained in:
swve 2023-12-27 14:07:17 +01:00
parent a7e2bda41e
commit 53c8c6046f
2 changed files with 3 additions and 4 deletions

View file

@ -23,7 +23,7 @@ async def authorization_verify_if_element_is_public(
if element_nature == "courses":
print("looking for course")
statement = select(Course).where(
Course.public is True, Course.course_uuid == element_uuid
Course.public == True, Course.course_uuid == element_uuid
)
course = db_session.exec(statement).first()
if course:
@ -33,7 +33,7 @@ async def authorization_verify_if_element_is_public(
if element_nature == "collections":
statement = select(Collection).where(
Collection.public is True, Collection.collection_uuid == element_uuid
Collection.public == True, Collection.collection_uuid == element_uuid
)
collection = db_session.exec(statement).first()

View file

@ -327,7 +327,7 @@ async def get_courses_orgslug(
statement_public = (
select(Course)
.join(Organization)
.where(Organization.slug == org_slug, Course.public is True)
.where(Organization.slug == org_slug, Course.public == True)
)
statement_all = (
select(Course).join(Organization).where(Organization.slug == org_slug)
@ -376,7 +376,6 @@ async def rbac_check(
res = await authorization_verify_if_element_is_public(
request, course_uuid, action, db_session
)
print('res',res)
return res
else:
res = await authorization_verify_based_on_roles_and_authorship(