8#include <userver/formats/parse/to.hpp>
10USERVER_NAMESPACE_BEGIN
12namespace server::auth {
14class UserScope
final {
16 explicit UserScope(std::string value) : value_(std::move(value)) {}
18 const std::string& GetValue()
const {
return value_; }
24inline bool operator==(
const UserScope& lhs,
const UserScope& rhs) {
return lhs.GetValue() == rhs.GetValue(); }
26inline bool operator!=(
const UserScope& lhs,
const UserScope& rhs) {
return lhs.GetValue() != rhs.GetValue(); }
28inline bool operator==(
const UserScope& lhs, std::string_view rhs) {
return lhs.GetValue() == rhs; }
30inline bool operator==(std::string_view lhs,
const UserScope& rhs) {
return lhs == rhs.GetValue(); }
32inline bool operator!=(
const UserScope& lhs, std::string_view rhs) {
return lhs.GetValue() != rhs; }
34inline bool operator!=(std::string_view lhs,
const UserScope& rhs) {
return lhs != rhs.GetValue(); }
38 return UserScope{v.
template As<std::string>()};
41using UserScopes = std::vector<UserScope>;
49struct hash<USERVER_NAMESPACE::server::auth::UserScope> {
50 std::size_t operator()(
const USERVER_NAMESPACE::server::auth::UserScope& v)
const {
51 return std::hash<std::string>{}(v.GetValue());