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:
@@ -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';
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -24,6 +24,7 @@ export class RemoteTokenGuard implements CanActivate {
|
||||
where: {
|
||||
remoteApiToken: token,
|
||||
isActive: true,
|
||||
product: { not: 'other' },
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
Reference in New Issue
Block a user