feat(FE) : setting access page master

This commit is contained in:
Yusron alamsyah
2026-02-23 14:29:56 +07:00
parent b3ac3a6b1a
commit b122aa6dad
13 changed files with 1009 additions and 44 deletions
-21
View File
@@ -144,24 +144,6 @@ export const useAuth = () => {
return !!userData
}
// Helper function to check if user has specific role
const hasRole = (role: string): boolean => {
if (!user.value) return false
// Check in roles array
if (user.value.roles?.includes(role)) return true
// Check in realm_access.roles
if (user.value.realm_access?.roles?.includes(role)) return true
return false
}
// Helper function to check if user has any of the specified roles
const hasAnyRole = (roles: string[]): boolean => {
return roles.some(role => hasRole(role))
}
return {
// State
user: readonly(user),
@@ -177,8 +159,5 @@ export const useAuth = () => {
refreshUser,
clearError,
// Utilities
hasRole,
hasAnyRole
}
}