3 #include <zk/config.hpp> 5 #include <initializer_list> 11 #include "forwards.hpp" 36 return permission(static_cast<unsigned int>(a) | static_cast<unsigned int>(b));
41 return permission(static_cast<unsigned int>(a) & static_cast<unsigned int>(b));
46 return permission(~static_cast<unsigned int>(a));
55 return (
self & perform) == perform;
58 std::ostream& operator<<(std::ostream&,
const permission&);
86 const std::string&
id()
const 112 std::ostream& operator<<(std::ostream&,
const acl_rule&);
114 std::string to_string(
const acl_rule&);
127 using iterator = std::vector<acl_rule>::iterator;
128 using const_iterator = std::vector<acl_rule>::const_iterator;
129 using size_type = std::size_t;
134 acl(std::vector<acl_rule> rules) noexcept;
136 acl(std::initializer_list<acl_rule> rules) :
137 acl(std::vector<acl_rule>(rules))
142 size_type size()
const {
return _impl.size(); }
144 const acl_rule& operator[](size_type idx)
const {
return _impl[idx]; }
146 iterator begin() {
return _impl.begin(); }
147 const_iterator begin()
const {
return _impl.begin(); }
148 const_iterator cbegin()
const {
return _impl.begin(); }
150 iterator end() {
return _impl.end(); }
151 const_iterator end()
const {
return _impl.end(); }
152 const_iterator cend()
const {
return _impl.end(); }
154 void reserve(size_type sz) { _impl.reserve(sz); }
156 template <
typename... TArgs>
157 void emplace_back(TArgs&&... args)
159 _impl.emplace_back(std::forward<TArgs>(args)...);
163 std::vector<acl_rule> _impl;
166 [[gnu::pure]]
bool operator==(
const acl& lhs,
const acl& rhs);
167 [[gnu::pure]]
bool operator!=(
const acl& lhs,
const acl& rhs);
169 std::ostream& operator<<(std::ostream&,
const acl&);
171 std::string to_string(
const acl&
self);
178 static const acl& creator_all();
181 static const acl& open_unsafe();
184 static const acl& read_unsafe();
195 class hash<
zk::acl_rule>
199 using result_type = std::size_t;
You can alter permissions on this node.
An individual rule in an acl.
const permission & permissions() const
The permissions associated with this ACL.
constexpr bool allows(permission self, permission perform)
Check that self allows it perform all operations.
No permissions are set (server could have been configured without ACL support).
Convenience operations around commonly-used ACLs.
You can create a child node.
You can access the data of a node and can list its children.
const std::string & id() const
The ID of the user under the scheme.
const std::string & scheme() const
The authentication scheme this list is used for.
permission
Describes the ability of a user to perform a certain action.
An access control list is a wrapper around acl_rule instances.
You can erase a child node (but not necessarily this one).
You can set the data of a node.