OmniSciDB  29e35f4d58
Parser::DropRoleStmt Class Reference

#include <ParserNode.h>

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

Public Member Functions

 DropRoleStmt (std::string *r)
 
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 1438 of file ParserNode.h.

Constructor & Destructor Documentation

◆ DropRoleStmt()

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

Definition at line 1440 of file ParserNode.h.

1440 : role(r) {}
std::unique_ptr< std::string > role
Definition: ParserNode.h:1445

Member Function Documentation

◆ execute()

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

Implements Parser::DDLStmt.

Definition at line 3801 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser().

3801  {
3802  const auto& currentUser = session.get_currentUser();
3803  if (!currentUser.isSuper) {
3804  throw std::runtime_error("DROP ROLE " + get_role() +
3805  " failed. It can only be executed by super user.");
3806  }
3807  auto* rl = SysCatalog::instance().getRoleGrantee(get_role());
3808  if (!rl) {
3809  throw std::runtime_error("DROP ROLE " + get_role() +
3810  " failed because role with this name does not exist.");
3811  }
3812  SysCatalog::instance().dropRole(get_role());
3813 }
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:93
const std::string & get_role() const
Definition: ParserNode.h:1441
+ Here is the call graph for this function:

◆ get_role()

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

Definition at line 1441 of file ParserNode.h.

1441 { return *role; }
std::unique_ptr< std::string > role
Definition: ParserNode.h:1445

Member Data Documentation

◆ role

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

Definition at line 1445 of file ParserNode.h.


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