mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
ca0da7a481
Introduced two additional columns in the system.query_log: used_privileges and missing_privileges. Used_privileges is populated with the privileges that were checked during query execution, and missing_privileges contains required privileges that are missing.
31 lines
827 B
C++
31 lines
827 B
C++
#pragma once
|
|
|
|
#include <Access/Common/AccessRightsElement.h>
|
|
#include <Access/ContextAccess.h>
|
|
#include <memory>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
class ContextAccess;
|
|
|
|
/// Checks if the current user has a specified access type granted,
|
|
/// and if it's checked another time later, it will just return the first result.
|
|
class CachedAccessChecking
|
|
{
|
|
public:
|
|
CachedAccessChecking(const std::shared_ptr<const ContextAccessWrapper> & access_, AccessFlags access_flags_);
|
|
CachedAccessChecking(const std::shared_ptr<const ContextAccessWrapper> & access_, const AccessRightsElement & element_);
|
|
~CachedAccessChecking();
|
|
|
|
bool checkAccess(bool throw_if_denied = true);
|
|
|
|
private:
|
|
const std::shared_ptr<const ContextAccessWrapper> access;
|
|
const AccessRightsElement element;
|
|
bool checked = false;
|
|
bool result = false;
|
|
};
|
|
|
|
}
|