user - auth - failWithException option
MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -158,7 +158,7 @@ export default class AuthorizationService {
}
public static async checkAndGetUserSitesAuthorizations(tenant: Tenant, userToken: UserToken,
- filteredRequest: Partial<HttpUserSitesGetRequest>): Promise<AuthorizationFilter> {
+ filteredRequest: Partial<HttpUserSitesGetRequest>, failsWithException = true): Promise<AuthorizationFilter> {
const authorizations: AuthorizationFilter = {
filters: {},
dataSources: new Map(),
@@ -169,7 +169,7 @@ export default class AuthorizationService {
authorizations.projectFields = AuthorizationService.filterProjectFields(authorizations.projectFields, filteredRequest.ProjectFields);
// Handle Sites
await this.canPerformAuthorizationAction(tenant, userToken, Entity.USER_SITE, Action.LIST,
- authorizations, filteredRequest, null, true);
+ authorizations, filteredRequest, null, failsWithException);
return authorizations;
}

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -357,7 +357,7 @@ export default class UserService {
const filteredRequest = UserValidatorRest.getInstance().validateUserSitesGetReq(req.query);
// Check dynamic auth for listing user sites
const authorizations = await AuthorizationService.checkAndGetUserSitesAuthorizations(req.tenant,
- req.user, filteredRequest);
+ req.user, filteredRequest, false);
if (!authorizations.authorized) {
UtilsService.sendEmptyDataResult(res, next);
return;

user - auth - failWithException option