XRootD
MapRule Struct Reference

#include <XrdSciTokensAccess.hh>

+ Collaboration diagram for MapRule:

Public Member Functions

 MapRule (const std::string &sub, const std::string &username, const std::string &path_prefix, const std::string &group, const std::string &result)
 
const std::string match (const std::string &sub, const std::string &username, const std::string_view &req_path, const std::vector< std::string > &groups) const
 

Public Attributes

std::string m_group
 
std::string m_path_prefix
 
std::string m_result
 
std::string m_sub
 
std::string m_username
 

Detailed Description

Definition at line 19 of file XrdSciTokensAccess.hh.

Constructor & Destructor Documentation

◆ MapRule()

MapRule::MapRule ( const std::string &  sub,
const std::string &  username,
const std::string &  path_prefix,
const std::string &  group,
const std::string &  result 
)
inline

Definition at line 21 of file XrdSciTokensAccess.hh.

26  : m_sub(sub),
27  m_username(username),
28  m_path_prefix(path_prefix),
29  m_group(group),
30  m_result(result)
31  {
32  //std::cerr << "Making a rule {sub=" << sub << ", username=" << username << ", path=" << path_prefix << ", group=" << group << ", result=" << name << "}" << std::endl;
33  }
std::string m_sub
std::string m_group
std::string m_result
std::string m_path_prefix
std::string m_username

Member Function Documentation

◆ match()

const std::string MapRule::match ( const std::string &  sub,
const std::string &  username,
const std::string_view &  req_path,
const std::vector< std::string > &  groups 
) const
inline

Definition at line 35 of file XrdSciTokensAccess.hh.

39  {
40  if (!m_sub.empty() && sub != m_sub) {return "";}
41 
42  if (!m_username.empty() && username != m_username) {return "";}
43 
44  if (!m_path_prefix.empty() &&
45  strncmp(req_path.data(), m_path_prefix.c_str(), m_path_prefix.size()))
46  {
47  return "";
48  }
49 
50  if (!m_group.empty()) {
51  for (const auto &group : groups) {
52  if (group == m_group)
53  return m_result;
54  }
55  return "";
56  }
57  return m_result;
58  }

References m_group, m_path_prefix, m_result, m_sub, and m_username.

Member Data Documentation

◆ m_group

std::string MapRule::m_group

Definition at line 63 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_path_prefix

std::string MapRule::m_path_prefix

Definition at line 62 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_result

std::string MapRule::m_result

Definition at line 64 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_sub

std::string MapRule::m_sub

Definition at line 60 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_username

std::string MapRule::m_username

Definition at line 61 of file XrdSciTokensAccess.hh.

Referenced by match().


The documentation for this struct was generated from the following file: