chore: remove obsolete python patch scripts and update API key fallback handling in frontend views
This commit is contained in:
@@ -208,14 +208,16 @@ export class AuthService {
|
||||
name,
|
||||
photoUrl,
|
||||
plan: isAdmin ? TenantPlan.ENTERPRISE : TenantPlan.FREE,
|
||||
role: isAdmin ? TenantRole.ADMIN : TenantRole.USER,
|
||||
isActive: true,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Auto-upgrade admins if they exist but are on lower plan
|
||||
const isAdmin = email === 'hamzaaleghwairyeen@gmail.com' || email === 'hamzadoctor@gmail.com' || email === 'hamzaayedpython@gmail.com';
|
||||
if (isAdmin && tenant.plan !== TenantPlan.ENTERPRISE) {
|
||||
// Auto-upgrade admins if they exist but are on lower plan or role
|
||||
const isAdmin = email === 'hamzaayedpython@gmail.com';
|
||||
if (isAdmin && (tenant.plan !== TenantPlan.ENTERPRISE || tenant.role !== TenantRole.ADMIN)) {
|
||||
tenant.plan = TenantPlan.ENTERPRISE;
|
||||
tenant.role = TenantRole.ADMIN;
|
||||
await this.tenantRepository.save(tenant);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ export class AdminGuard implements CanActivate {
|
||||
throw new UnauthorizedException('Tenant not found in request');
|
||||
}
|
||||
|
||||
if (tenant.plan !== TenantPlan.ENTERPRISE) {
|
||||
throw new ForbiddenException('Admin access required. Your tenant plan must be ENTERPRISE.');
|
||||
if (tenant.plan !== TenantPlan.ENTERPRISE && tenant.role !== TenantRole.ADMIN) {
|
||||
throw new ForbiddenException('Admin access required. Your tenant must have an ENTERPRISE plan or ADMIN clearance.');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,10 +3,11 @@ import { ApiExcludeController } from '@nestjs/swagger';
|
||||
import { CommunityService } from './community.service';
|
||||
import { ReviewContributionDto } from './dto/review-contribution.dto';
|
||||
import { ApiKeyGuard } from '../common/guards/api-key.guard';
|
||||
import { AdminGuard } from '../common/guards/admin.guard';
|
||||
|
||||
@ApiExcludeController()
|
||||
@Controller('v1/admin/moderation')
|
||||
@UseGuards(ApiKeyGuard)
|
||||
@UseGuards(ApiKeyGuard, AdminGuard)
|
||||
export class ModerationController {
|
||||
constructor(private readonly communityService: CommunityService) {}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export class HeritageController {
|
||||
},
|
||||
variable: [
|
||||
{ key: "baseUrl", value: "https://map-saas.intaleqapp.com/api", type: "string" },
|
||||
{ key: "apiKey", value: "zP9vL5mK2nQ8xR7jT4wS1yB6hG3fV0cX", type: "string" }
|
||||
{ key: "apiKey", value: process.env.MAP_API_KEY || "", type: "string" }
|
||||
],
|
||||
item: [
|
||||
{
|
||||
|
||||
@@ -5,12 +5,13 @@ import { Repository, DataSource } from 'typeorm';
|
||||
import { CandidateRoad } from './candidate-road.entity';
|
||||
import { RoadSegmentStat } from './road-stat.entity';
|
||||
import { ApiKeyGuard } from '../common/guards/api-key.guard';
|
||||
import { AdminGuard } from '../common/guards/admin.guard';
|
||||
import { RedisService } from '../common/redis.service';
|
||||
|
||||
@ApiExcludeController()
|
||||
@ApiTags('map-refinement-roads')
|
||||
@Controller('map-refinement/roads')
|
||||
@UseGuards(ApiKeyGuard)
|
||||
@UseGuards(ApiKeyGuard, AdminGuard)
|
||||
export class RoadRefinementController {
|
||||
private readonly logger = new Logger(RoadRefinementController.name);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { ApiExcludeController, ApiHeader, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { ApiKeyGuard } from '../common/guards/api-key.guard';
|
||||
import { AdminGuard } from '../common/guards/admin.guard';
|
||||
import { TenantThrottlerGuard } from '../common/guards/rate-limiter.guard';
|
||||
import { LineOfSightBodyDto, LineOfSightQueryDto } from './dto/line-of-sight.dto';
|
||||
import { ArtilleryMissionRequestDto, SaveScenarioDto } from './dto/tactical.dto';
|
||||
@@ -22,7 +23,7 @@ import { RoutingPackageService } from './routing-package.service';
|
||||
|
||||
@ApiExcludeController()
|
||||
@Controller('tactical')
|
||||
@UseGuards(ApiKeyGuard, TenantThrottlerGuard)
|
||||
@UseGuards(ApiKeyGuard, AdminGuard, TenantThrottlerGuard)
|
||||
export class TacticalController {
|
||||
constructor(
|
||||
private readonly tacticalService: TacticalService,
|
||||
|
||||
Reference in New Issue
Block a user