forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthorization_scopes.h
More file actions
26 lines (23 loc) · 835 Bytes
/
authorization_scopes.h
File metadata and controls
26 lines (23 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef NMOS_AUTHORIZATION_SCOPES_H
#define NMOS_AUTHORIZATION_SCOPES_H
#include <set>
#include <boost/range/adaptor/transformed.hpp>
#include "nmos/scope.h"
#include "nmos/settings.h"
namespace nmos
{
namespace experimental
{
namespace authorization_scopes
{
// get scope set from settings
inline std::set<scope> from_settings(const nmos::settings& settings)
{
return settings.has_field(nmos::experimental::fields::authorization_scopes)
? boost::copy_range<std::set<scope>>(nmos::experimental::fields::authorization_scopes(settings) | boost::adaptors::transformed([](const web::json::value& v) { return nmos::experimental::parse_scope(v.as_string()); }))
: std::set<scope>{};
}
}
}
}
#endif