Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
authorization_manager.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <utility>
8#include <functional>
9
10namespace sysio { namespace chain {
11
12 class controller;
13 struct updateauth;
14 struct deleteauth;
15 struct linkauth;
16 struct unlinkauth;
17 struct canceldelay;
18
20 public:
22
24
25 void add_indices();
27 void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const;
28 void read_from_snapshot( const snapshot_reader_ptr& snapshot );
29
32 permission_id_type parent,
33 const authority& auth,
34 time_point initial_creation_time = time_point()
35 );
36
39 permission_id_type parent,
40 authority&& auth,
41 time_point initial_creation_time = time_point()
42 );
43
44 void modify_permission( const permission_object& permission, const authority& auth );
45
46 void remove_permission( const permission_object& permission );
47
48 void update_permission_usage( const permission_object& permission );
49
51
52 const permission_object* find_permission( const permission_level& level )const;
53 const permission_object& get_permission( const permission_level& level )const;
54
62 std::optional<permission_name> lookup_minimum_permission( account_name authorizer_account,
63 scope_name code_account,
64 action_name type
65 )const;
66
77 void
78 check_authorization( const vector<action>& actions,
79 const flat_set<public_key_type>& provided_keys,
80 const flat_set<permission_level>& provided_permissions = flat_set<permission_level>(),
81 fc::microseconds provided_delay = fc::microseconds(0),
82 const std::function<void()>& checktime = std::function<void()>(),
83 bool allow_unused_keys = false,
84 bool check_but_dont_fail = false,
85 const flat_set<permission_level>& satisfied_authorizations = flat_set<permission_level>()
86 )const;
87
88
100 void
102 permission_name permission,
103 const flat_set<public_key_type>& provided_keys,
104 const flat_set<permission_level>& provided_permissions = flat_set<permission_level>(),
105 fc::microseconds provided_delay = fc::microseconds(0),
106 const std::function<void()>& checktime = std::function<void()>(),
107 bool allow_unused_keys = false
108 )const;
109
110 flat_set<public_key_type> get_required_keys( const transaction& trx,
111 const flat_set<public_key_type>& candidate_keys,
112 fc::microseconds provided_delay = fc::microseconds(0)
113 )const;
114
115
116 static std::function<void()> _noop_checktime;
117
118 private:
119 const controller& _control;
121
122 void check_updateauth_authorization( const updateauth& update, const vector<permission_level>& auths )const;
123 void check_deleteauth_authorization( const deleteauth& del, const vector<permission_level>& auths )const;
124 void check_linkauth_authorization( const linkauth& link, const vector<permission_level>& auths )const;
125 void check_unlinkauth_authorization( const unlinkauth& unlink, const vector<permission_level>& auths )const;
126 fc::microseconds check_canceldelay_authorization( const canceldelay& cancel, const vector<permission_level>& auths )const;
127
128 std::optional<permission_name> lookup_linked_permission( account_name authorizer_account,
129 scope_name code_account,
130 action_name type
131 )const;
132 };
133
134} }
authorization_manager(controller &c, chainbase::database &d)
fc::time_point get_permission_last_used(const permission_object &permission) const
static std::function< void()> _noop_checktime
void add_to_snapshot(const snapshot_writer_ptr &snapshot) const
std::optional< permission_name > lookup_minimum_permission(account_name authorizer_account, scope_name code_account, action_name type) const
Find the lowest authority level required for authorizer_account to authorize a message of the specifi...
void update_permission_usage(const permission_object &permission)
void read_from_snapshot(const snapshot_reader_ptr &snapshot)
void check_authorization(const vector< action > &actions, const flat_set< public_key_type > &provided_keys, const flat_set< permission_level > &provided_permissions=flat_set< permission_level >(), fc::microseconds provided_delay=fc::microseconds(0), const std::function< void()> &checktime=std::function< void()>(), bool allow_unused_keys=false, bool check_but_dont_fail=false, const flat_set< permission_level > &satisfied_authorizations=flat_set< permission_level >()) const
Check authorizations of a vector of actions with provided keys, permission levels,...
const permission_object & get_permission(const permission_level &level) const
void remove_permission(const permission_object &permission)
const permission_object & create_permission(account_name account, permission_name name, permission_id_type parent, const authority &auth, time_point initial_creation_time=time_point())
const permission_object * find_permission(const permission_level &level) const
void modify_permission(const permission_object &permission, const authority &auth)
flat_set< public_key_type > get_required_keys(const transaction &trx, const flat_set< public_key_type > &candidate_keys, fc::microseconds provided_delay=fc::microseconds(0)) const
permission_object::id_type permission_id_type
sysio::chain::action_name action_name
std::shared_ptr< snapshot_writer > snapshot_writer_ptr
Definition snapshot.hpp:155
std::shared_ptr< snapshot_reader > snapshot_reader_ptr
Definition snapshot.hpp:294
Immutable except for fc::from_variant.
Definition name.hpp:43