OmniSciDB  467d548b97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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)
 
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 1498 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 1500 of file ParserNode.h.

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

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 3960 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser().

3960  {
3961  const auto& currentUser = session.get_currentUser();
3962  if (!currentUser.isSuper) {
3963  throw std::runtime_error("DROP ROLE " + get_role() +
3964  " failed. It can only be executed by super user.");
3965  }
3966  auto* rl = SysCatalog::instance().getRoleGrantee(get_role());
3967  if (!rl) {
3968  throw std::runtime_error("DROP ROLE " + get_role() +
3969  " failed because role with this name does not exist.");
3970  }
3971  SysCatalog::instance().dropRole(get_role());
3972 }
const std::string & get_role() const
Definition: ParserNode.h:1501
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:68

+ Here is the call graph for this function:

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

Definition at line 1501 of file ParserNode.h.

References role.

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

Member Data Documentation

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

Definition at line 1505 of file ParserNode.h.

Referenced by get_role().


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