Remove tenant UI; restrict machine links to non-admin users; polish Users/Machines UX
This commit is contained in:
parent
4a30a1b564
commit
347609a186
3 changed files with 54 additions and 87 deletions
|
|
@ -1088,6 +1088,10 @@ export const linkUser = mutation({
|
|||
.withIndex("by_tenant_email", (q) => q.eq("tenantId", tenantId).eq("email", normalized))
|
||||
.first()
|
||||
if (!user) throw new ConvexError("Usuário não encontrado")
|
||||
const role = (user.role ?? "").toUpperCase()
|
||||
if (role === 'ADMIN' || role === 'AGENT') {
|
||||
throw new ConvexError('Usuários administrativos não podem ser vinculados a máquinas')
|
||||
}
|
||||
|
||||
const current = new Set<Id<"users">>(machine.linkedUserIds ?? [])
|
||||
current.add(user._id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue