comparison Plugin/Plugin.cpp @ 138:f448e8626f1a

Now handling new GET /tools/create-archive and sibling routes
author Alain Mazy <am@osimis.io>
date Sat, 25 Nov 2023 12:18:14 +0100
parents 8b123c2adb69
children 423531fb1200
comparison
equal deleted inserted replaced
137:0fa3a38eb72f 138:f448e8626f1a
376 return 0; // Unable to parse this URI 376 return 0; // Unable to parse this URI
377 } 377 }
378 378
379 // Loop over all the accessed resources to ensure access is 379 // Loop over all the accessed resources to ensure access is
380 // granted to each of them 380 // granted to each of them
381 int checkedResources = 0;
382 int grantedResources = 0;
383
381 for (OrthancPlugins::IAuthorizationParser::AccessedResources::const_iterator 384 for (OrthancPlugins::IAuthorizationParser::AccessedResources::const_iterator
382 access = accesses.begin(); access != accesses.end(); ++access) 385 access = accesses.begin(); access != accesses.end(); ++access)
383 { 386 {
384 if (IsResourceAccessGranted(authTokens, method, *access)) 387 if (uncheckedLevels_.find(access->GetLevel()) == uncheckedLevels_.end())
385 { 388 {
386 return 1; 389 checkedResources++;
387 } 390 if (IsResourceAccessGranted(authTokens, method, *access))
391 {
392 grantedResources++;
393 }
394 }
395 }
396
397 if (checkedResources > 0 && grantedResources == checkedResources)
398 {
399 return 1;
388 } 400 }
389 } 401 }
390 402
391 // By default, forbid access to all the resources 403 // By default, forbid access to all the resources
392 return 0; 404 return 0;