diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx index ce227e4d..dca31493 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx @@ -8,7 +8,7 @@ import { revalidateTags } from "@services/utils/ts/requests"; import ActivityIndicators from "@components/Pages/Courses/ActivityIndicators"; import { useRouter } from "next/navigation"; import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper"; -import { getCourseThumbnailMediaDirectory } from "@services/media/media"; +import { getCourseThumbnailMediaDirectory, getUserAvatarMediaDirectory } from "@services/media/media"; import { ArrowRight, Check, File, Sparkles, Star, Video } from "lucide-react"; import Avvvatars from "avvvatars-react"; import { getUser } from "@services/users/users"; @@ -193,7 +193,7 @@ const CourseClient = (props: any) => {
{user &&
- +
Author
diff --git a/apps/web/components/Objects/UserAvatar.tsx b/apps/web/components/Objects/UserAvatar.tsx index 7b1d6bd3..837dd05b 100644 --- a/apps/web/components/Objects/UserAvatar.tsx +++ b/apps/web/components/Objects/UserAvatar.tsx @@ -30,6 +30,7 @@ function UserAvatar(props: UserAvatarProps) { return predefinedAvatar } else { if (props.avatar_url) { + console.log('avatar_url',props.avatar_url) return props.avatar_url } else { diff --git a/apps/web/components/Security/AuthenticatedClientElement.tsx b/apps/web/components/Security/AuthenticatedClientElement.tsx index ac505f34..138b4ca5 100644 --- a/apps/web/components/Security/AuthenticatedClientElement.tsx +++ b/apps/web/components/Security/AuthenticatedClientElement.tsx @@ -17,18 +17,18 @@ export const AuthenticatedClientElement = (props: AuthenticatedClientElementProp const [isAllowed, setIsAllowed] = React.useState(false); const session = useSession() as any; const org = useOrg() as any; - + function isUserAllowed(roles: any[], action: string, resourceType: string, org_uuid: string): boolean { // Iterate over the user's roles for (const role of roles) { - + // Check if the role is for the right organization if (role.org.org_uuid === org_uuid) { // Check if the user has the role for the resource type if (role.role.rights && role.role.rights[resourceType]) { - + // Check if the user is allowed to execute the action const actionKey = `action_${action}`; if (role.role.rights[resourceType][actionKey] === true) { @@ -43,11 +43,16 @@ export const AuthenticatedClientElement = (props: AuthenticatedClientElementProp } function check() { - - if (props.checkMethod === 'authentication') { - setIsAllowed(session.isAuthenticated); - } else if (props.checkMethod === 'roles') { - return setIsAllowed(isUserAllowed(session.roles, props.action!, props.ressourceType!, org.org_uuid)); + if (session.isAuthenticated === false) { + setIsAllowed(false); + return; + } + else { + if (props.checkMethod === 'authentication') { + setIsAllowed(session.isAuthenticated); + } else if (props.checkMethod === 'roles') { + return setIsAllowed(isUserAllowed(session.roles, props.action!, props.ressourceType!, org.org_uuid)); + } } }