| 389 | } |
| 390 | |
| 391 | void AccessControl::addDiskStorage(const String & storage_name_, const String & directory_, bool readonly_, bool allow_backup_) |
| 392 | { |
| 393 | auto storages = getStoragesPtr(); |
| 394 | for (const auto & storage : *storages) |
| 395 | { |
| 396 | if (auto disk_storage = typeid_cast<std::shared_ptr<DiskAccessStorage>>(storage)) |
| 397 | { |
| 398 | if (disk_storage->isPathEqual(directory_)) |
| 399 | { |
| 400 | if (readonly_) |
| 401 | disk_storage->setReadOnly(readonly_); |
| 402 | return; |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | auto new_storage = std::make_shared<DiskAccessStorage>(storage_name_, directory_, *changes_notifier, readonly_, allow_backup_); |
| 407 | addStorage(new_storage); |
| 408 | LOG_DEBUG(getLogger(), "Added {} access storage '{}', path: {}", String(new_storage->getStorageType()), new_storage->getStorageName(), new_storage->getPath()); |
| 409 | } |
| 410 | |
| 411 | |
| 412 | void AccessControl::addMemoryStorage(const String & storage_name_, bool allow_backup_) |
no test coverage detected