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": if element_nature == "courses":
print("looking for course") print("looking for course")
statement = select(Course).where( 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() course = db_session.exec(statement).first()
if course: if course:
@ -33,7 +33,7 @@ async def authorization_verify_if_element_is_public(
if element_nature == "collections": if element_nature == "collections":
statement = select(Collection).where( 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() collection = db_session.exec(statement).first()

View file

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