@djangocfg/layouts 1.2.26 → 1.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/layouts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "Layout system and components for Unrealon applications",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "DjangoCFG",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"check": "tsc --noEmit"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@djangocfg/api": "^1.2.
|
|
67
|
-
"@djangocfg/og-image": "^1.2.
|
|
68
|
-
"@djangocfg/ui": "^1.2.
|
|
66
|
+
"@djangocfg/api": "^1.2.27",
|
|
67
|
+
"@djangocfg/og-image": "^1.2.27",
|
|
68
|
+
"@djangocfg/ui": "^1.2.27",
|
|
69
69
|
"@hookform/resolvers": "^5.2.0",
|
|
70
70
|
"consola": "^3.4.2",
|
|
71
71
|
"lucide-react": "^0.468.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"vidstack": "0.6.15"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
89
|
+
"@djangocfg/typescript-config": "^1.2.27",
|
|
90
90
|
"@types/node": "^24.7.2",
|
|
91
91
|
"@types/react": "19.2.2",
|
|
92
92
|
"@types/react-dom": "19.2.1",
|
|
@@ -430,6 +430,11 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
|
|
|
430
430
|
return finalUrl;
|
|
431
431
|
}, [getFinalRedirectUrl, clearSavedRedirectUrl]);
|
|
432
432
|
|
|
433
|
+
// Computed: Is admin user (staff or superuser)
|
|
434
|
+
const isAdminUser = useMemo(() => {
|
|
435
|
+
return Boolean(user?.is_staff || user?.is_superuser);
|
|
436
|
+
}, [user]);
|
|
437
|
+
|
|
433
438
|
// Memoized context value
|
|
434
439
|
const value = useMemo<AuthContextType>(
|
|
435
440
|
() => ({
|
|
@@ -437,6 +442,7 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
|
|
|
437
442
|
isLoading,
|
|
438
443
|
// Consider authenticated if we have valid tokens, even without user profile
|
|
439
444
|
isAuthenticated: api.isAuthenticated(),
|
|
445
|
+
isAdminUser,
|
|
440
446
|
loadCurrentProfile,
|
|
441
447
|
checkAuthAndRedirect,
|
|
442
448
|
getToken: () => api.getToken(),
|
|
@@ -461,6 +467,7 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
|
|
|
461
467
|
[
|
|
462
468
|
user,
|
|
463
469
|
isLoading,
|
|
470
|
+
isAdminUser,
|
|
464
471
|
loadCurrentProfile,
|
|
465
472
|
checkAuthAndRedirect,
|
|
466
473
|
storedEmail,
|
|
@@ -16,36 +16,36 @@ export interface PackageInfo {
|
|
|
16
16
|
/**
|
|
17
17
|
* Package versions registry
|
|
18
18
|
* Auto-synced from package.json files
|
|
19
|
-
* Last updated: 2025-11-
|
|
19
|
+
* Last updated: 2025-11-06T16:31:19.441Z
|
|
20
20
|
*/
|
|
21
21
|
const PACKAGE_VERSIONS: PackageInfo[] = [
|
|
22
22
|
{
|
|
23
23
|
"name": "@djangocfg/ui",
|
|
24
|
-
"version": "1.2.
|
|
24
|
+
"version": "1.2.27"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "@djangocfg/api",
|
|
28
|
-
"version": "1.2.
|
|
28
|
+
"version": "1.2.27"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "@djangocfg/layouts",
|
|
32
|
-
"version": "1.2.
|
|
32
|
+
"version": "1.2.27"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"name": "@djangocfg/markdown",
|
|
36
|
-
"version": "1.2.
|
|
36
|
+
"version": "1.2.27"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "@djangocfg/og-image",
|
|
40
|
-
"version": "1.2.
|
|
40
|
+
"version": "1.2.27"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"name": "@djangocfg/eslint-config",
|
|
44
|
-
"version": "1.2.
|
|
44
|
+
"version": "1.2.27"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"name": "@djangocfg/typescript-config",
|
|
48
|
-
"version": "1.2.
|
|
48
|
+
"version": "1.2.27"
|
|
49
49
|
}
|
|
50
50
|
];
|
|
51
51
|
|
|
@@ -115,7 +115,7 @@ function AdminLayoutClient({
|
|
|
115
115
|
config,
|
|
116
116
|
enableParentSync = true
|
|
117
117
|
}: AdminLayoutProps) {
|
|
118
|
-
const { user, isLoading, isAuthenticated, loadCurrentProfile } = useAuth();
|
|
118
|
+
const { isAdminUser, user, isLoading, isAuthenticated, loadCurrentProfile } = useAuth();
|
|
119
119
|
// console.log('[AdminLayout] Rendering with user:', user, 'isLoading:', isLoading, 'isAuthenticated:', isAuthenticated);
|
|
120
120
|
|
|
121
121
|
// useCfgApp hook is called here to initialize iframe communication
|
|
@@ -164,17 +164,9 @@ function AdminLayoutClient({
|
|
|
164
164
|
return <LoadingState />;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
// Check if user has staff or superuser privileges
|
|
168
|
-
// At this point, we KNOW that:
|
|
169
|
-
// 1. User is loaded (not null)
|
|
170
|
-
// 2. User is authenticated
|
|
171
|
-
// 3. Auth process is complete
|
|
172
|
-
const hasAdminAccess = user.is_staff || user.is_superuser;
|
|
173
|
-
// console.log('[AdminLayout] user:', user, 'hasAdminAccess:', hasAdminAccess, 'is_staff:', user.is_staff, 'is_superuser:', user.is_superuser);
|
|
174
|
-
|
|
175
167
|
// Only show "Access Denied" when we are CERTAIN user doesn't have permissions
|
|
176
168
|
// This prevents showing the message during auth/loading states
|
|
177
|
-
if (!
|
|
169
|
+
if (!isAdminUser) {
|
|
178
170
|
// Only show this when user is fully authenticated but lacks permissions
|
|
179
171
|
// console.log('[AdminLayout] Authenticated user lacks admin permissions');
|
|
180
172
|
return (
|