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 20 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 22 of file XrdSciTokensAccess.hh.

27  : m_sub(sub),
28  m_username(username),
29  m_path_prefix(path_prefix),
30  m_group(group),
31  m_result(result)
32  {
33  //std::cerr << "Making a rule {sub=" << sub << ", username=" << username << ", path=" << path_prefix << ", group=" << group << ", result=" << name << "}" << std::endl;
34  }
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 36 of file XrdSciTokensAccess.hh.

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

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 64 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_path_prefix

std::string MapRule::m_path_prefix

Definition at line 63 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_result

std::string MapRule::m_result

Definition at line 65 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_sub

std::string MapRule::m_sub

Definition at line 61 of file XrdSciTokensAccess.hh.

Referenced by match().

◆ m_username

std::string MapRule::m_username

Definition at line 62 of file XrdSciTokensAccess.hh.

Referenced by match().


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