ewmscp  ..
acl.h
Go to the documentation of this file.
1 #ifndef __acl_h__
2 #define __acl_h__
3 
4 #include <vector>
5 #include "enumAsBitmask.h"
6 
7 namespace acl {
8  class list {
9  public:
10  class entryType {
11  public:
12  union {
13  id_t e_id;
14  char * e_who;
15  };
16  enum class typeValue : bool {
19  } _type;
20  void setType(bool aIsAllowedType) {
22  }
23  bool isAllowedType() const {
25  }
26  bool isDeniedType() const {
28  }
29  enum class flagsType : unsigned short {
30  file_inherit_ace = 0x0001,
31  directory_inherit_ace = 0x0002,
32  no_propagate_inherit_ace = 0x0004,
33  inherit_only_ace = 0x0008,
34  identifier_group = 0x0040,
35  inherited_ace = 0x0080,
36  unmapped_who = 0x2000,
37  special_who = 0x4000,
40  };
42  void setFlags(unsigned short aFlags) {
43  _flags = static_cast<flagsType>(aFlags);
44  }
45  void addFlags(flagsType aFlags) {
46  _flags |= aFlags;
47  }
48  bool isFlagSet(flagsType aFlag) const {
49  return _flags & aFlag;
50  }
51  typename std::underlying_type<decltype(_flags)::enumType>::type getFlagBits() const {
52  return _flags.asBits();
53  }
54 
55 
56  enum class maskType : unsigned int {
57  read_data = 0x00000001,
58  list_directory = 0x00000001,
59  write_data = 0x00000002,
60  add_file = 0x00000002,
61  append_data = 0x00000004,
62  add_subdirectory = 0x00000004,
63  read_named_attrs = 0x00000008,
64  write_named_attrs = 0x00000010,
65  execute = 0x00000020,
66  delete_child = 0x00000040,
67  read_attributes = 0x00000080,
68  write_attributes = 0x00000100,
69  write_retention = 0x00000200,
70  write_retention_hold = 0x00000400,
71  delete_ = 0x00010000,
72  read_acl = 0x00020000,
73  write_acl = 0x00040000,
74  write_owner = 0x00080000,
75  synchronize = 0x00100000,
77  };
79  void setMask(unsigned int aMask) {
80  _mask = static_cast<maskType>(aMask);
81  }
82  typename std::underlying_type<decltype(_mask)::enumType>::type getMaskBits() const {
83  return _mask.asBits();
84  }
85 
86  static std::vector<std::pair<list::entryType::maskType, char>> aclMaskBits;
87 
88  enum specialIdType : unsigned char {
92  };
93  };
94  enum class flagsType : unsigned char {
95  auto_inherit = 0x01,
96  protected_ = 0x02,
97  defaulted = 0x04,
98  write_through = 0x40,
99  masked = 0x80,
101  };
102  protected:
104  unsigned int a_owner_mask;
105  unsigned int a_group_mask;
106  unsigned int a_other_mask;
107  public:
108  std::vector<entryType> entries;
109 
110  list();
111  ~list();
112  };
113 } // end namespace scl
114 #endif
acl::list::flagsType::masked
@ masked
acl::list::a_other_mask
unsigned int a_other_mask
Definition: acl.h:106
acl::list::entryType::maskType::write_acl
@ write_acl
acl::list::entryType::_mask
enumAsBitmask< maskType > _mask
Definition: acl.h:78
acl::list::entryType::everyone_special_id
@ everyone_special_id
Definition: acl.h:91
acl::list::entryType::maskType::read_attributes
@ read_attributes
acl::list::entryType::flagsType::no_propagate_inherit_ace
@ no_propagate_inherit_ace
acl::list::entryType::maskType::delete_
@ delete_
acl::list::entryType::typeValue::access_denied_ace_type
@ access_denied_ace_type
acl::list::flagsType::valid_flags
@ valid_flags
acl::list::entryType::maskType::synchronize
@ synchronize
acl::list::entryType::setFlags
void setFlags(unsigned short aFlags)
Definition: acl.h:42
acl::list::entryType::e_id
id_t e_id
Definition: acl.h:13
acl::list::a_group_mask
unsigned int a_group_mask
Definition: acl.h:105
acl::list::entryType::maskType::add_subdirectory
@ add_subdirectory
acl::list::entryType::_type
enum acl::list::entryType::typeValue _type
acl::list::entryType::maskType::write_owner
@ write_owner
acl::list::entryType::maskType::read_data
@ read_data
acl::list::entryType::maskType::read_acl
@ read_acl
acl::list::entryType::flagsType::special_who
@ special_who
acl::list::entryType::_flags
enumAsBitmask< flagsType > _flags
Definition: acl.h:41
acl::list::entryType::maskType::execute
@ execute
acl::list::entryType::maskType::append_data
@ append_data
acl::list::entryType::maskType::write_retention
@ write_retention
acl::list::entryType::flagsType::unmapped_who
@ unmapped_who
acl::list::entryType::flagsType::inherit_only_ace
@ inherit_only_ace
acl::list::entryType::maskType::write_named_attrs
@ write_named_attrs
acl::list::entryType::maskType::valid_flags
@ valid_flags
acl::list::entryType::addFlags
void addFlags(flagsType aFlags)
Definition: acl.h:45
acl::list::entryType::maskType::write_data
@ write_data
acl::list::entryType::isAllowedType
bool isAllowedType() const
Definition: acl.h:23
acl::list::entryType::maskType::add_file
@ add_file
acl::list::entryType::owner_special_id
@ owner_special_id
Definition: acl.h:89
acl::list::entryType::maskType
maskType
Definition: acl.h:56
acl::list::entryType::getMaskBits
std::underlying_type< decltype(_mask)::enumType >::type getMaskBits() const
Definition: acl.h:82
acl::list::entryType::aclMaskBits
static std::vector< std::pair< list::entryType::maskType, char > > aclMaskBits
Definition: acl.h:86
acl::list::entryType
Definition: acl.h:10
acl::list::flagsType
flagsType
Definition: acl.h:94
enumAsBitmask.h
acl::list::entryType::typeValue::access_allowed_ace_type
@ access_allowed_ace_type
acl::list::entryType::setType
void setType(bool aIsAllowedType)
Definition: acl.h:20
acl::list
Definition: acl.h:8
acl::list::list
list()
Definition: acl.cpp:11
acl::list::entryType::flagsType::valid_flags
@ valid_flags
enumAsBitmask::asBits
std::underlying_type< T >::type asBits() const
Definition: enumAsBitmask.h:15
acl::list::entryType::flagsType::identifier_group
@ identifier_group
acl::list::entryType::isDeniedType
bool isDeniedType() const
Definition: acl.h:26
acl::list::flags
enumAsBitmask< flagsType > flags
Definition: acl.h:103
acl::list::entryType::setMask
void setMask(unsigned int aMask)
Definition: acl.h:79
acl::list::entryType::flagsType::inheritance_flags
@ inheritance_flags
acl::list::entryType::getFlagBits
std::underlying_type< decltype(_flags)::enumType >::type getFlagBits() const
Definition: acl.h:51
acl::list::flagsType::write_through
@ write_through
acl::list::entryType::typeValue
typeValue
Definition: acl.h:16
acl::list::a_owner_mask
unsigned int a_owner_mask
Definition: acl.h:104
acl::list::flagsType::protected_
@ protected_
acl::list::entryType::flagsType::inherited_ace
@ inherited_ace
acl::list::entryType::specialIdType
specialIdType
Definition: acl.h:88
acl::list::entryType::flagsType::directory_inherit_ace
@ directory_inherit_ace
acl::list::entryType::flagsType::file_inherit_ace
@ file_inherit_ace
acl::list::~list
~list()
Definition: acl.cpp:12
acl::list::entryType::maskType::write_attributes
@ write_attributes
acl::list::entries
std::vector< entryType > entries
Definition: acl.h:108
acl::list::flagsType::defaulted
@ defaulted
enumAsBitmask< flagsType >
acl::list::entryType::maskType::list_directory
@ list_directory
acl::list::entryType::maskType::delete_child
@ delete_child
acl::list::entryType::isFlagSet
bool isFlagSet(flagsType aFlag) const
Definition: acl.h:48
acl::list::entryType::maskType::read_named_attrs
@ read_named_attrs
acl::list::entryType::group_special_id
@ group_special_id
Definition: acl.h:90
acl::list::entryType::e_who
char * e_who
Definition: acl.h:14
acl
Definition: acl.cpp:10
acl::list::entryType::maskType::write_retention_hold
@ write_retention_hold
acl::list::flagsType::auto_inherit
@ auto_inherit
acl::list::entryType::flagsType
flagsType
Definition: acl.h:29