feat(idnot): statuts précis auth — 401 email manquant, 403 non-rattachement office
Some checks failed
build-and-push-ext / build_push (push) Failing after 4s
Some checks failed
build-and-push-ext / build_push (push) Failing after 4s
This commit is contained in:
parent
7541bce346
commit
d1075d3f3b
@ -4,7 +4,7 @@ import { IdNotService } from '../services/idnot';
|
||||
import { authTokens } from '../utils/auth-tokens';
|
||||
import { IdNotUser, AuthToken } from '../types';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { NotFoundError, ExternalServiceError, BusinessRuleError } from '../types/errors';
|
||||
import { NotFoundError, ExternalServiceError, BusinessRuleError, UnauthorizedError, ForbiddenError } from '../types/errors';
|
||||
|
||||
/**
|
||||
* Pure controller methods that handle business logic
|
||||
@ -105,7 +105,7 @@ export class IdNotController {
|
||||
const userData = await IdNotService.getUserData(payload.profile_idn);
|
||||
|
||||
if (!userData || !userData.statutDuRattachement || userData.entite.typeEntite.name !== 'office') {
|
||||
throw new BusinessRuleError('User not attached to an office');
|
||||
throw new ForbiddenError('User not attached to an office');
|
||||
}
|
||||
|
||||
// Get office location data
|
||||
@ -143,7 +143,7 @@ export class IdNotController {
|
||||
};
|
||||
|
||||
if (!idNotUser.contact.email) {
|
||||
throw new BusinessRuleError('User professional email is empty');
|
||||
throw new UnauthorizedError('Email not found');
|
||||
}
|
||||
|
||||
// Generate auth token
|
||||
|
Loading…
x
Reference in New Issue
Block a user