mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Merge pull request #7155 from Elias481/bugfix/evaluatefilter-assign-this-scope-6874
use current frame scope for permission filter function calls
This commit is contained in:
commit
edaaaae1e8
@ -157,7 +157,7 @@ void FilterUtility::CheckPermission(const ApiUser::Ptr& user, const String& perm
|
|||||||
|
|
||||||
if (filter && permissionFilter) {
|
if (filter && permissionFilter) {
|
||||||
std::vector<std::unique_ptr<Expression> > args;
|
std::vector<std::unique_ptr<Expression> > args;
|
||||||
args.emplace_back(new GetScopeExpression(ScopeLocal));
|
args.emplace_back(new GetScopeExpression(ScopeThis));
|
||||||
std::unique_ptr<Expression> indexer{new IndexerExpression(std::unique_ptr<Expression>(MakeLiteral(filter)), std::unique_ptr<Expression>(MakeLiteral("call")))};
|
std::unique_ptr<Expression> indexer{new IndexerExpression(std::unique_ptr<Expression>(MakeLiteral(filter)), std::unique_ptr<Expression>(MakeLiteral("call")))};
|
||||||
FunctionCallExpression *fexpr = new FunctionCallExpression(std::move(indexer), std::move(args));
|
FunctionCallExpression *fexpr = new FunctionCallExpression(std::move(indexer), std::move(args));
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
|||||||
CheckPermission(user, qd.Permission, &permissionFilter);
|
CheckPermission(user, qd.Permission, &permissionFilter);
|
||||||
|
|
||||||
Namespace::Ptr permissionFrameNS = new Namespace();
|
Namespace::Ptr permissionFrameNS = new Namespace();
|
||||||
ScriptFrame permissionFrame(true, permissionFrameNS);
|
ScriptFrame permissionFrame(false, permissionFrameNS);
|
||||||
|
|
||||||
for (const String& type : qd.Types) {
|
for (const String& type : qd.Types) {
|
||||||
String attr = type;
|
String attr = type;
|
||||||
@ -243,7 +243,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
|||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query."));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query."));
|
||||||
|
|
||||||
Namespace::Ptr frameNS = new Namespace();
|
Namespace::Ptr frameNS = new Namespace();
|
||||||
ScriptFrame frame(true, frameNS);
|
ScriptFrame frame(false, frameNS);
|
||||||
frame.Sandboxed = true;
|
frame.Sandboxed = true;
|
||||||
|
|
||||||
if (query->Contains("filter")) {
|
if (query->Contains("filter")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user