OmniSciDB  f632821e96
Parser::RevokeRoleStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::RevokeRoleStmt:
+ Collaboration diagram for Parser::RevokeRoleStmt:

Public Member Functions

 RevokeRoleStmt (std::list< std::string *> *r, std::list< std::string *> *g)
 
const std::vector< std::string > & get_roles () const
 
const std::vector< std::string > & get_grantees () 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::vector< std::string > roles
 
std::vector< std::string > grantees
 

Detailed Description

Definition at line 1616 of file ParserNode.h.

Constructor & Destructor Documentation

◆ RevokeRoleStmt()

Parser::RevokeRoleStmt::RevokeRoleStmt ( std::list< std::string *> *  r,
std::list< std::string *> *  g 
)
inline

Definition at line 1618 of file ParserNode.h.

References Parser::parser_slistval_to_vector().

1618  {
1621  }
void parser_slistval_to_vector(std::list< std::string *> *l, std::vector< std::string > &v)
Definition: ParserNode.h:1508
std::vector< std::string > roles
Definition: ParserNode.h:1627
std::vector< std::string > grantees
Definition: ParserNode.h:1628
+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

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

Implements Parser::DDLStmt.

Definition at line 4308 of file ParserNode.cpp.

References parse_ast::end, Catalog_Namespace::SessionInfo::get_currentUser(), and OMNISCI_ROOT_USER.

4308  {
4309  const auto& currentUser = session.get_currentUser();
4310  if (!currentUser.isSuper) {
4311  throw std::runtime_error(
4312  "REVOKE failed, because it can only be executed by super user.");
4313  }
4314  if (std::find(get_grantees().begin(), get_grantees().end(), OMNISCI_ROOT_USER) !=
4315  get_grantees().end()) {
4316  throw std::runtime_error(
4317  "Request to revoke role failed because privileges can not be revoked from mapd "
4318  "root user.");
4319  }
4320  SysCatalog::instance().revokeRoleBatch(get_roles(), get_grantees());
4321 }
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1623
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:68
const std::string OMNISCI_ROOT_USER
Definition: SysCatalog.h:57
const std::vector< std::string > & get_roles() const
Definition: ParserNode.h:1622
+ Here is the call graph for this function:

◆ get_grantees()

const std::vector<std::string>& Parser::RevokeRoleStmt::get_grantees ( ) const
inline

Definition at line 1623 of file ParserNode.h.

1623 { return grantees; }
std::vector< std::string > grantees
Definition: ParserNode.h:1628

◆ get_roles()

const std::vector<std::string>& Parser::RevokeRoleStmt::get_roles ( ) const
inline

Definition at line 1622 of file ParserNode.h.

1622 { return roles; }
std::vector< std::string > roles
Definition: ParserNode.h:1627

Member Data Documentation

◆ grantees

std::vector<std::string> Parser::RevokeRoleStmt::grantees
private

Definition at line 1628 of file ParserNode.h.

◆ roles

std::vector<std::string> Parser::RevokeRoleStmt::roles
private

Definition at line 1627 of file ParserNode.h.


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