admin_rights.hpp
// ---------------------------------------------------------------------
// pion: a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2014 Splunk Inc. (https://github.com/splunk/pion)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//
#ifndef __PION_ADMIN_RIGHTS_HEADER__
#define __PION_ADMIN_RIGHTS_HEADER__
#include <pion/config.hpp>
#include <pion/logger.hpp>
#include <boost/cstdint.hpp>
#include <boost/thread/mutex.hpp>
namespace pion { // begin namespace pion
class PION_API admin_rights {
public:
admin_rights(bool use_log = true);
virtual ~admin_rights() { release(); }
void release(void);
static long run_as_user(const std::string& user_name);
static long run_as_group(const std::string& group_name);
private:
static long find_system_id(const std::string& name, const std::string& file);
static const boost::int16_t ADMIN_USER_ID;
static boost::mutex m_mutex;
logger m_logger;
boost::unique_lock<boost::mutex> m_lock;
boost::int16_t m_user_id;
bool m_has_rights;
bool m_use_log;
};
} // end namespace pion
#endif
pion::logger
Definition: logger.hpp:238
pion
Definition: admin_rights.hpp:19
pion::admin_rights::~admin_rights
virtual ~admin_rights()
destructor releases administrative rights
Definition: admin_rights.hpp:37
pion::admin_rights
Definition: admin_rights.hpp:25