MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / filterAccessElementForHints

Function filterAccessElementForHints

src/Access/ContextAccess.cpp:60–76  ·  view source on GitHub ↗

Filter access-denied hint output (the "required grant"/"missing permissions" text in ACCESS_DENIED errors). Column names from implicit expansion (e.g. SELECT *) require SHOW_COLUMNS to be shown in hints.

Source from the content-addressed store, hash-verified

58 /// Filter access-denied hint output (the "required grant"/"missing permissions" text in ACCESS_DENIED errors).
59 /// Column names from implicit expansion (e.g. SELECT *) require SHOW_COLUMNS to be shown in hints.
60 AccessRightsElement filterAccessElementForHints(const AccessRightsElement & element, const AccessRights & access)
61 {
62 if (element.columns.empty())
63 return element;
64
65 // Columns imply a resolved table and database (current DB is already substituted upstream).
66 chassert(!element.table.empty());
67 chassert(!element.database.empty());
68
69 if (access.isGranted(AccessType::SHOW_COLUMNS, element.database, element.table, element.columns))
70 return element;
71
72 // Hide column names unless SHOW_COLUMNS covers all required columns.
73 AccessRightsElement res = element;
74 res.columns.clear();
75 return res;
76 }
77
78 AccessRightsElements filterAccessElementsForHints(const AccessRightsElements & elements, const AccessRights & access)
79 {

Callers 2

checkAccessImplHelperMethod · 0.85

Calls 3

emptyMethod · 0.45
isGrantedMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected