OmniSciDB  eb3a3d0a03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::DropRoleStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DropRoleStmt:
+ Collaboration diagram for Parser::DropRoleStmt:

Public Member Functions

 DropRoleStmt (std::string *r)
 
 DropRoleStmt (const rapidjson::Value &payload)
 
const std::string & get_role () const
 
void execute (const Catalog_Namespace::SessionInfo &session) override
 
- Public Member Functions inherited from Parser::DDLStmt
void setColumnDescriptor (ColumnDescriptor &cd, const ColumnDef *coldef)
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Private Attributes

std::unique_ptr< std::string > role_
 

Detailed Description

Definition at line 1537 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::DropRoleStmt::DropRoleStmt ( std::string *  r)
inline

Definition at line 1539 of file ParserNode.h.

1539 : role_(r) {}
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1545
Parser::DropRoleStmt::DropRoleStmt ( const rapidjson::Value &  payload)

Definition at line 5073 of file ParserNode.cpp.

References CHECK, json_str(), and role_.

5073  {
5074  CHECK(payload.HasMember("role"));
5075  role_ = std::make_unique<std::string>(json_str(payload["role"]));
5076 }
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1545
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

Member Function Documentation

void Parser::DropRoleStmt::execute ( const Catalog_Namespace::SessionInfo session)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 5078 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser(), and get_role().

Referenced by omnisci.cursor.Cursor::executemany().

5078  {
5079  const auto& currentUser = session.get_currentUser();
5080  if (!currentUser.isSuper) {
5081  throw std::runtime_error("DROP ROLE " + get_role() +
5082  " failed. It can only be executed by super user.");
5083  }
5084  auto* rl = SysCatalog::instance().getRoleGrantee(get_role());
5085  if (!rl) {
5086  throw std::runtime_error("DROP ROLE " + get_role() +
5087  " failed because role with this name does not exist.");
5088  }
5089  SysCatalog::instance().dropRole(get_role(), /*is_temporary=*/false);
5090 }
const std::string & get_role() const
Definition: ParserNode.h:1541
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::string& Parser::DropRoleStmt::get_role ( ) const
inline

Definition at line 1541 of file ParserNode.h.

References role_.

Referenced by execute().

1541 { return *role_; }
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1545

+ Here is the caller graph for this function:

Member Data Documentation

std::unique_ptr<std::string> Parser::DropRoleStmt::role_
private

Definition at line 1545 of file ParserNode.h.

Referenced by DropRoleStmt(), and get_role().


The documentation for this class was generated from the following files: