feat: Allow super-admins to retrieve courses across organizations and update navigation link styles to text-sm and text-slate-600.
This commit is contained in:
@@ -2415,16 +2415,26 @@ pub struct CourseWithOutline {
|
|||||||
|
|
||||||
pub async fn get_course_outline(
|
pub async fn get_course_outline(
|
||||||
Org(org_ctx): Org,
|
Org(org_ctx): Org,
|
||||||
|
claims: common::auth::Claims,
|
||||||
State(pool): State<PgPool>,
|
State(pool): State<PgPool>,
|
||||||
Path(id): Path<Uuid>,
|
Path(id): Path<Uuid>,
|
||||||
) -> Result<Json<CourseWithOutline>, StatusCode> {
|
) -> Result<Json<CourseWithOutline>, StatusCode> {
|
||||||
|
let is_super_admin = claims.role == "admin"
|
||||||
|
&& claims.org == Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap();
|
||||||
|
|
||||||
// 1. Fetch Course
|
// 1. Fetch Course
|
||||||
let course =
|
let course = if is_super_admin {
|
||||||
|
sqlx::query_as::<_, Course>("SELECT * FROM courses WHERE id = $1")
|
||||||
|
.bind(id)
|
||||||
|
.fetch_one(&pool)
|
||||||
|
.await
|
||||||
|
} else {
|
||||||
sqlx::query_as::<_, Course>("SELECT * FROM courses WHERE id = $1 AND organization_id = $2")
|
sqlx::query_as::<_, Course>("SELECT * FROM courses WHERE id = $1 AND organization_id = $2")
|
||||||
.bind(id)
|
.bind(id)
|
||||||
.bind(org_ctx.id)
|
.bind(org_ctx.id)
|
||||||
.fetch_one(&pool)
|
.fetch_one(&pool)
|
||||||
.await
|
.await
|
||||||
|
}
|
||||||
.map_err(|_| StatusCode::NOT_FOUND)?;
|
.map_err(|_| StatusCode::NOT_FOUND)?;
|
||||||
|
|
||||||
// 2. Fetch Modules
|
// 2. Fetch Modules
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-link-standard {
|
.nav-link-standard {
|
||||||
@apply text-xs font-bold uppercase tracking-widest transition-colors flex items-center gap-2;
|
@apply text-sm font-bold uppercase tracking-wider transition-colors flex items-center gap-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glass-card:hover {
|
.glass-card:hover {
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ export default function AppHeader() {
|
|||||||
|
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<nav className="hidden md:flex items-center gap-8 mr-4" aria-label="Navegación principal">
|
<nav className="hidden md:flex items-center gap-8 mr-4" aria-label="Navegación principal">
|
||||||
<Link href="/" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
<Link href="/" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||||
{t('nav.catalog')}
|
{t('nav.catalog')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/my-learning" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
<Link href="/my-learning" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||||
{t('nav.myLearning')}
|
{t('nav.myLearning')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/bookmarks" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
<Link href="/bookmarks" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||||
{t('nav.bookmarks')}
|
{t('nav.bookmarks')}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-link-standard {
|
.nav-link-standard {
|
||||||
@apply text-xs font-bold uppercase tracking-widest transition-colors flex items-center gap-2;
|
@apply text-sm font-bold uppercase tracking-wider transition-colors flex items-center gap-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-premium {
|
.btn-premium {
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ export default function CourseEditorLayout({ children, activeTab }: CourseEditor
|
|||||||
<Link
|
<Link
|
||||||
href={tab.href}
|
href={tab.href}
|
||||||
aria-current={isActive ? "page" : undefined}
|
aria-current={isActive ? "page" : undefined}
|
||||||
className={`flex items-center gap-1.5 px-4 py-3 text-xs font-bold uppercase tracking-widest transition-all whitespace-nowrap flex-shrink-0 border-b-2 ${isActive
|
className={`nav-link-standard px-4 py-3 border-b-2 whitespace-nowrap ${isActive
|
||||||
? "border-blue-600 dark:border-blue-500 bg-black/5 dark:bg-white/5 text-blue-600 dark:text-white"
|
? "border-blue-600 dark:border-blue-500 text-blue-600 dark:text-white"
|
||||||
: "border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
|
: "border-transparent text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Icon className="w-4 h-4 flex-shrink-0" aria-hidden="true" />
|
<Icon className="w-4 h-4 flex-shrink-0" aria-hidden="true" />
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function Navbar() {
|
|||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
href="/"
|
||||||
className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||||
>
|
>
|
||||||
<LayoutDashboard className="w-4 h-4" />
|
<LayoutDashboard className="w-4 h-4" />
|
||||||
{t('nav.courses')}
|
{t('nav.courses')}
|
||||||
@@ -52,7 +52,7 @@ export function Navbar() {
|
|||||||
|
|
||||||
<Link
|
<Link
|
||||||
href="/library/assets"
|
href="/library/assets"
|
||||||
className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||||
>
|
>
|
||||||
<Library className="w-4 h-4" aria-hidden="true" />
|
<Library className="w-4 h-4" aria-hidden="true" />
|
||||||
{t('nav.library') || 'Library'}
|
{t('nav.library') || 'Library'}
|
||||||
@@ -64,7 +64,7 @@ export function Navbar() {
|
|||||||
{user.organization_id === '00000000-0000-0000-0000-000000000001' && (
|
{user.organization_id === '00000000-0000-0000-0000-000000000001' && (
|
||||||
<Link
|
<Link
|
||||||
href="/admin"
|
href="/admin"
|
||||||
className="text-xs font-black text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-2 bg-indigo-500/10 px-3 py-1.5 rounded-lg border border-indigo-500/20 shadow-glow-sm uppercase tracking-widest"
|
className="text-sm font-black text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-2 bg-indigo-500/10 px-3 py-1.5 rounded-lg border border-indigo-500/20 shadow-glow-sm uppercase tracking-wider"
|
||||||
>
|
>
|
||||||
<ShieldCheck className="w-4 h-4" aria-hidden="true" />
|
<ShieldCheck className="w-4 h-4" aria-hidden="true" />
|
||||||
{t('nav.globalControl')}
|
{t('nav.globalControl')}
|
||||||
@@ -72,14 +72,14 @@ export function Navbar() {
|
|||||||
)}
|
)}
|
||||||
<Link
|
<Link
|
||||||
href="/settings/webhooks"
|
href="/settings/webhooks"
|
||||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||||
>
|
>
|
||||||
<Webhook className="w-4 h-4" />
|
<Webhook className="w-4 h-4" />
|
||||||
{t('nav.webhooks')}
|
{t('nav.webhooks')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href="/profile"
|
href="/profile"
|
||||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||||
>
|
>
|
||||||
<Settings className="w-4 h-4" />
|
<Settings className="w-4 h-4" />
|
||||||
{t('nav.profile')}
|
{t('nav.profile')}
|
||||||
@@ -89,7 +89,7 @@ export function Navbar() {
|
|||||||
|
|
||||||
<Link
|
<Link
|
||||||
href="/settings"
|
href="/settings"
|
||||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||||
>
|
>
|
||||||
<Settings className="w-4 h-4" />
|
<Settings className="w-4 h-4" />
|
||||||
Settings
|
Settings
|
||||||
|
|||||||
Reference in New Issue
Block a user