Drop the AGPL license in favor of a source-available license. See the blog post [1] for details. [1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
39 lines
980 B
C++
39 lines
980 B
C++
/*
|
|
* Copyright (C) 2017-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#include "auth/permissions_cache.hh"
|
|
|
|
#include <fmt/ranges.h>
|
|
#include "auth/authorizer.hh"
|
|
#include "auth/service.hh"
|
|
|
|
namespace auth {
|
|
|
|
permissions_cache::permissions_cache(const utils::loading_cache_config& c, service& ser, logging::logger& log)
|
|
: _cache(c, log, [&ser, &log](const key_type& k) {
|
|
log.debug("Refreshing permissions for {}", k.first);
|
|
return ser.get_uncached_permissions(k.first, k.second);
|
|
}) {
|
|
}
|
|
|
|
bool permissions_cache::update_config(utils::loading_cache_config c) {
|
|
return _cache.update_config(std::move(c));
|
|
}
|
|
|
|
void permissions_cache::reset() {
|
|
_cache.reset();
|
|
}
|
|
|
|
future<permission_set> permissions_cache::get(const role_or_anonymous& maybe_role, const resource& r) {
|
|
return do_with(key_type(maybe_role, r), [this](const auto& k) {
|
|
return _cache.get(k);
|
|
});
|
|
}
|
|
|
|
}
|