refactor: Remove dedicated role management page and update authentication, roles, and permission handling across backend and frontend.
This commit is contained in:
@@ -223,7 +223,7 @@ export const listar = query({
|
||||
_id: usuario.roleId,
|
||||
descricao: 'Perfil não encontrado' as const,
|
||||
nome: 'erro_role_ausente' as const,
|
||||
nivel: 999 as const,
|
||||
admin: false as const,
|
||||
erro: true as const
|
||||
},
|
||||
funcionario,
|
||||
@@ -237,11 +237,6 @@ export const listar = query({
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filtrar por setor
|
||||
if (args.setor && role.setor !== args.setor) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Buscar funcionário associado
|
||||
let funcionario;
|
||||
if (usuario.funcionarioId) {
|
||||
@@ -264,18 +259,11 @@ export const listar = query({
|
||||
}
|
||||
}
|
||||
|
||||
// Construir objeto role - incluir _creationTime se existir (campo automático do Convex)
|
||||
const roleObj = {
|
||||
_id: role._id,
|
||||
descricao: role.descricao,
|
||||
nome: role.nome,
|
||||
nivel: role.nivel,
|
||||
...(role.criadoPor !== undefined && { criadoPor: role.criadoPor }),
|
||||
...(role.customizado !== undefined && {
|
||||
customizado: role.customizado
|
||||
}),
|
||||
...(role.editavel !== undefined && { editavel: role.editavel }),
|
||||
...(role.setor !== undefined && { setor: role.setor })
|
||||
admin: role.admin ?? false
|
||||
};
|
||||
|
||||
const matriculaUsuario = await obterMatriculaUsuario(ctx, usuario);
|
||||
@@ -514,7 +502,6 @@ export const atualizarPerfil = mutation({
|
||||
|
||||
if (args.fotoPerfil !== undefined) updates.fotoPerfil = args.fotoPerfil;
|
||||
if (args.avatar !== undefined) updates.avatar = args.avatar;
|
||||
if (args.setor !== undefined) updates.setor = args.setor;
|
||||
if (args.statusMensagem !== undefined) updates.statusMensagem = args.statusMensagem;
|
||||
if (args.statusPresenca !== undefined) {
|
||||
updates.statusPresenca = args.statusPresenca;
|
||||
@@ -610,7 +597,6 @@ export const obterPerfil = query({
|
||||
fotoPerfil: usuarioAtual.fotoPerfil,
|
||||
fotoPerfilUrl,
|
||||
avatar: usuarioAtual.avatar,
|
||||
setor: usuarioAtual.setor,
|
||||
statusMensagem: usuarioAtual.statusMensagem,
|
||||
statusPresenca: usuarioAtual.statusPresenca,
|
||||
notificacoesAtivadas: usuarioAtual.notificacoesAtivadas ?? true,
|
||||
@@ -941,7 +927,6 @@ export const editarUsuario = mutation({
|
||||
if (args.nome !== undefined) updates.nome = args.nome;
|
||||
if (args.email !== undefined) updates.email = args.email;
|
||||
if (args.roleId !== undefined) updates.roleId = args.roleId;
|
||||
if (args.setor !== undefined) updates.setor = args.setor;
|
||||
|
||||
await ctx.db.patch(args.usuarioId, updates);
|
||||
|
||||
@@ -987,10 +972,7 @@ export const criarAdminMaster = mutation({
|
||||
const roleId = await ctx.db.insert('roles', {
|
||||
nome: 'ti_master',
|
||||
descricao: 'TI Master',
|
||||
nivel: 0,
|
||||
setor: 'ti',
|
||||
customizado: false,
|
||||
editavel: false
|
||||
admin: true
|
||||
});
|
||||
roleTIMaster = await ctx.db.get(roleId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user