sapling/eden/fs/service/ThriftPermissionChecker.h
Xavier Deguillard a29d465ee8 fs: fix license header
Summary:
With Facebook having been renamed Meta Platforms, we need to change the license
headers.

Reviewed By: fanzeyi

Differential Revision: D33407812

fbshipit-source-id: b11bfbbf13a48873f0cea75f212cc7b07a68fb2e
2022-01-04 15:00:07 -08:00

44 lines
1.1 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <thrift/lib/cpp/TProcessorEventHandler.h>
#include <stdexcept>
namespace facebook {
namespace eden {
class ServerState;
class NotAuthorized : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
/**
* Throws NotAuthorized in preRead if process connected to Eden's unix domain
* socket has an effective uid not allowed to access a given Thrift method.
*/
class ThriftPermissionChecker : public apache::thrift::TProcessorEventHandler {
public:
explicit ThriftPermissionChecker(std::shared_ptr<ServerState> serverState);
void* getContext(
const char* fn_name,
apache::thrift::TConnectionContext* connectionContext) override;
void freeContext(void* ctx, const char* fn_name) override;
void preRead(void* ctx, const char* fn_name) override;
private:
std::shared_ptr<ServerState> serverState_;
};
} // namespace eden
} // namespace facebook