feat: add 'other' product type for miscellaneous sites (tracking only, no remote control)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 16:52:23 +03:30
co-authored by Cursor
parent 0c29222e9d
commit 674da4e939
13 changed files with 34 additions and 15 deletions
+9 -2
View File
@@ -12,6 +12,8 @@ export const PERMISSIONS = [
'hamkar:write',
'khanegi:read',
'khanegi:write',
'others:read',
'others:write',
'admins:read',
'admins:write',
'audit:read',
@@ -36,6 +38,7 @@ export const PERMISSION_MODULES: PermissionModule[] = [
{ key: 'support', label: 'پشتیبانی', read: 'support:read', write: 'support:write' },
{ key: 'hamkar', label: 'همکار', read: 'hamkar:read', write: 'hamkar:write' },
{ key: 'khanegi', label: 'خانگی', read: 'khanegi:read', write: 'khanegi:write' },
{ key: 'others', label: 'سایت‌های دیگر', read: 'others:read', write: 'others:write' },
{ key: 'admins', label: 'مدیران', read: 'admins:read', write: 'admins:write' },
{ key: 'audit', label: 'لاگ', read: 'audit:read' },
{ key: 'settings', label: 'تنظیمات حساس', write: 'settings:write' },
@@ -94,9 +97,13 @@ export function userHasAllPermissions(
}
export function productReadPermission(product: string): PermissionCode {
return product === 'hamkar' ? 'hamkar:read' : 'khanegi:read';
if (product === 'hamkar') return 'hamkar:read';
if (product === 'other') return 'others:read';
return 'khanegi:read';
}
export function productWritePermission(product: string): PermissionCode {
return product === 'hamkar' ? 'hamkar:write' : 'khanegi:write';
if (product === 'hamkar') return 'hamkar:write';
if (product === 'other') return 'others:write';
return 'khanegi:write';
}
+2 -2
View File
@@ -130,7 +130,7 @@ export class RemoteSmsAuthGuard implements CanActivate {
if (!token || token.length < 16) return null;
return this.prisma.tenant.findFirst({
where: { remoteApiToken: token, isActive: true },
where: { remoteApiToken: token, isActive: true, product: { not: 'other' } },
select: {
id: true,
nameFa: true,
@@ -146,7 +146,7 @@ export class RemoteSmsAuthGuard implements CanActivate {
if (!normalizedHost) return null;
const tenants = await this.prisma.tenant.findMany({
where: { isActive: true },
where: { isActive: true, product: { not: 'other' } },
select: {
id: true,
nameFa: true,
+1
View File
@@ -24,6 +24,7 @@ export class RemoteTokenGuard implements CanActivate {
where: {
remoteApiToken: token,
isActive: true,
product: { not: 'other' },
},
select: {
id: true,