MantisBase v0.4.9
Loading...
Searching...
No Matches
mb::MbAccessRule Class Reference

Access control rule for entity permissions. More...

#include <access_rules.h>

Public Member Functions

 MbAccessRule (const std::string &mode="", const std::string &expr="", const std::string &entity="")
nlohmann::json toJSON () const
std::string mode () const
void setMode (const std::string &_mode)
std::string expr () const
void setExpr (const std::string &_expr)
std::string entity () const
void setEntity (const std::string &_entity)
bool matchesAuthEntity (const std::string &userEntity) const

Static Public Member Functions

static MbAccessRule fromJSON (const nlohmann::json &j)

Detailed Description

Access control rule for entity permissions.

Modes: public, auth (optional comma-separated entity filter), custom (expr), or empty string (admin only).

Constructor & Destructor Documentation

◆ MbAccessRule()

mb::MbAccessRule::MbAccessRule ( const std::string & mode = "",
const std::string & expr = "",
const std::string & entity = "" )
explicit

Construct a rule from mode, optional custom expression, and optional entity filter.

Member Function Documentation

◆ entity()

std::string mb::MbAccessRule::entity ( ) const
nodiscard

Comma-separated auth entity filter for auth mode (e.g. users, users,editors, !guests).

◆ expr()

std::string mb::MbAccessRule::expr ( ) const
nodiscard
Returns
Custom expression when mode is custom.

◆ fromJSON()

MbAccessRule mb::MbAccessRule::fromJSON ( const nlohmann::json & j)
static

Parse rule from stored schema JSON.

◆ matchesAuthEntity()

bool mb::MbAccessRule::matchesAuthEntity ( const std::string & userEntity) const
nodiscard

Check whether userEntity satisfies the auth mode entity filter.

◆ mode()

std::string mb::MbAccessRule::mode ( ) const
nodiscard
Returns
Rule mode: public, auth, custom, or empty (admin-only).

◆ setEntity()

void mb::MbAccessRule::setEntity ( const std::string & _entity)

◆ setExpr()

void mb::MbAccessRule::setExpr ( const std::string & _expr)

◆ setMode()

void mb::MbAccessRule::setMode ( const std::string & _mode)

◆ toJSON()

nlohmann::json mb::MbAccessRule::toJSON ( ) const
nodiscard

Serialize rule to JSON (mode, expr, entity).


The documentation for this class was generated from the following files:
  • /home/runner/work/mantisbase/mantisbase/include/mantisbase/core/models/access_rules.h
  • /home/runner/work/mantisbase/mantisbase/src/core/models/access_rules.cpp