mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: public courses & collections bug
This commit is contained in:
parent
d3853c69ce
commit
d939dc16eb
7 changed files with 87 additions and 46 deletions
|
|
@ -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)
|
||||
|
|
@ -364,7 +364,6 @@ async def get_courses_orgslug(
|
|||
|
||||
## 🔒 RBAC Utils ##
|
||||
|
||||
|
||||
async def rbac_check(
|
||||
request: Request,
|
||||
course_uuid: str,
|
||||
|
|
@ -374,13 +373,16 @@ async def rbac_check(
|
|||
):
|
||||
if action == "read":
|
||||
if current_user.id == 0: # Anonymous user
|
||||
await authorization_verify_if_element_is_public(
|
||||
res = await authorization_verify_if_element_is_public(
|
||||
request, course_uuid, action, db_session
|
||||
)
|
||||
print('res',res)
|
||||
return res
|
||||
else:
|
||||
await authorization_verify_based_on_roles_and_authorship(
|
||||
res = await authorization_verify_based_on_roles_and_authorship(
|
||||
request, current_user.id, action, course_uuid, db_session
|
||||
)
|
||||
return res
|
||||
else:
|
||||
await authorization_verify_if_user_is_anon(current_user.id)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue