refactor: update permissions and clean up Svelte component
- Removed outdated information about the permissions system from the Svelte component. - Added new actions for resource management in the backend, including 'aprovar_ausencias' and 'aprovar_ferias'. - Cleaned up console logs in the user retrieval function for better performance and security.
This commit is contained in:
@@ -428,48 +428,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Informações sobre o sistema de permissões -->
|
|
||||||
<div class="alert alert-info mb-6 shadow-lg">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-6 shrink-0 stroke-current"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-lg font-bold">Como funciona o sistema de permissões:</h3>
|
|
||||||
<div class="mt-3 grid grid-cols-1 gap-3 md:grid-cols-2">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-sm font-semibold">Tipos de Permissão:</h4>
|
|
||||||
<ul class="mt-1 space-y-1 text-sm">
|
|
||||||
<li>
|
|
||||||
• <strong>Acessar:</strong> Visualizar menu e acessar página
|
|
||||||
</li>
|
|
||||||
<li>• <strong>Consultar:</strong> Ver dados (requer "Acessar")</li>
|
|
||||||
<li>
|
|
||||||
• <strong>Gravar:</strong> Criar/editar/excluir (requer "Consultar")
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4 class="text-sm font-semibold">Perfis Especiais:</h4>
|
|
||||||
<ul class="mt-1 space-y-1 text-sm">
|
|
||||||
<li>• <strong>Admin:</strong> Acesso total automático</li>
|
|
||||||
<li>• <strong>TI Master:</strong> Controle administrativo completo</li>
|
|
||||||
<li>• <strong>Dashboard:</strong> Público para todos</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Matriz de Permissões por Ação -->
|
<!-- Matriz de Permissões por Ação -->
|
||||||
{#if rolesQuery.isLoading || catalogoQuery.isLoading}
|
{#if rolesQuery.isLoading || catalogoQuery.isLoading}
|
||||||
<div class="flex items-center justify-center py-12">
|
<div class="flex items-center justify-center py-12">
|
||||||
|
|||||||
@@ -8,7 +8,16 @@ import { getCurrentUserFunction } from './auth';
|
|||||||
export const CATALOGO_RECURSOS = [
|
export const CATALOGO_RECURSOS = [
|
||||||
{
|
{
|
||||||
recurso: 'funcionarios',
|
recurso: 'funcionarios',
|
||||||
acoes: ['dashboard', 'ver', 'listar', 'criar', 'editar', 'excluir']
|
acoes: [
|
||||||
|
'dashboard',
|
||||||
|
'ver',
|
||||||
|
'listar',
|
||||||
|
'criar',
|
||||||
|
'editar',
|
||||||
|
'excluir',
|
||||||
|
'aprovar_ausencias',
|
||||||
|
'aprovar_ferias'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
recurso: 'simbolos',
|
recurso: 'simbolos',
|
||||||
|
|||||||
@@ -562,15 +562,12 @@ export const obterPerfil = query({
|
|||||||
),
|
),
|
||||||
handler: async (ctx) => {
|
handler: async (ctx) => {
|
||||||
const usuarioAutenticado = await getCurrentUserFunction(ctx);
|
const usuarioAutenticado = await getCurrentUserFunction(ctx);
|
||||||
console.log('Usuario autenticado:', usuarioAutenticado);
|
|
||||||
if (!usuarioAutenticado) {
|
if (!usuarioAutenticado) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const usuarioAtual = usuarioAutenticado;
|
const usuarioAtual = usuarioAutenticado;
|
||||||
|
|
||||||
console.log('✅ Usuário encontrado:', usuarioAtual.nome);
|
|
||||||
|
|
||||||
// Buscar fotoPerfil URL se existir
|
// Buscar fotoPerfil URL se existir
|
||||||
let fotoPerfilUrl = null;
|
let fotoPerfilUrl = null;
|
||||||
if (usuarioAtual.fotoPerfil) {
|
if (usuarioAtual.fotoPerfil) {
|
||||||
|
|||||||
Reference in New Issue
Block a user