libzypp: zypp/ng/userrequest.cc Source File

libzypp 17.38.14

userrequest.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#include "userrequest.h"
10
11namespace zyppng {
12
13 UserData AcceptNoDigestRequest::makeData(const zypp::Pathname &p) {
14 UserData d( CTYPE.data() );
15 d.set( FILE.data(), p );
16 return d;
17 }
18
19 UserData AcceptUnknownDigestRequest::makeData(const zypp::Pathname &p, const std::string &name) {
20 UserData d( CTYPE.data() );
21 d.set( FILE.data(), p );
22 d.set( NAME.data(), name );
23 return d;
24 }
25
26 UserData AcceptWrongDigestRequest::makeData(const zypp::Pathname &p, const std::string &requested, const std::string &found) {
27 UserData d( CTYPE.data() );
28 d.set( FILE.data(), p );
29 d.set( NAME_REQUESTED.data(), requested );
30 d.set( NAME_FOUND.data(), found );
31 return d;
32 }
33
34 ZYPP_IMPL_PRIVATE_CONSTR_ARGS(TrustKeyRequest, std::string label, KeyTrust trust, UserData userData )
35 : UserRequest( std::move(userData) )
36 , _label( std::move(label) )
37 , _answer(trust)
38 { }
39
40 void TrustKeyRequest::setChoice(const KeyTrust sel)
41 { _answer = sel; }
42
43 TrustKeyRequest::KeyTrust TrustKeyRequest::choice() const
44 { return _answer; }
45
46 const std::string TrustKeyRequest::label() const
47 { return _label; }
48
49 UserRequestType TrustKeyRequest::type() const
50 { return UserRequestType::KeyTrust; }
51
52 UserData AcceptKeyRequest::makeData(const zypp::PublicKey &key, const zypp::KeyContext &keycontext)
53 {
54 UserData d( CTYPE.data() );
55 d.set( KEY.data(), key );
56 d.set( KEY_CONTEXT.data(), keycontext );
57 return d;
58 }
59
60 UserData VerifyInfoEvent::makeData(const std::string &file_r, const zypp::PublicKeyData &keyData_r, const zypp::KeyContext &keycontext)
61 {
62 UserData d( CTYPE.data() );
63 d.set( FILE.data(), file_r );
64 d.set( KEY_DATA.data(), keyData_r );
65 d.set( KEY_CONTEXT.data(), keycontext );
66 return d;
67 }
68
69 UserData AcceptUnsignedFileRequest::makeData(const std::string &file, const zypp::KeyContext &keycontext)
70 {
71 UserData d( CTYPE.data() );
72 d.set( FILE.data(), file );
73 d.set( KEY_CONTEXT.data(), keycontext );
74 return d;
75 }
76
77 UserData AcceptUnknownKeyRequest::makeData(const std::string &file, const std::string &id, const zypp::KeyContext &keycontext)
78 {
79 UserData d( CTYPE.data() );
80 d.set( KEYID.data(), id );
81 d.set( FILE.data(), file );
82 d.set( KEY_CONTEXT.data(), keycontext );
83 return d;
84 }
85
86 UserData AcceptFailedVerificationRequest::makeData(const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext)
87 {
88 UserData d( CTYPE.data() );
89 d.set( KEY.data(), key );
90 d.set( FILE.data(), file );
91 d.set( KEY_CONTEXT.data(), keycontext );
92 return d;
93 }
94
95 UserData AcceptPackageKeyRequest::makeData(const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r)
96 {
97 UserData d( CTYPE.data() );
98 d.set( KEY.data(), key_r );
99 d.set( KEY_CONTEXT.data(), keycontext_r );
100 return d;
101 }
102
103 UserData NonImportedKeysInfoEvent::makeData(const std::set<zypp::Edition> &keys_r)
104 {
105 UserData d( CTYPE.data() );
106 d.set( KEYS.data(), &keys_r );
107 return d;
108 }
109
110 UserData KeyAutoImportInfoEvent::makeData(const std::list<zypp::PublicKeyData> &keyDataList_r, const zypp::PublicKeyData &keySigning_r, const zypp::KeyContext &keyContext_r)
111 {
112 UserData d( CTYPE.data() );
113 d.set( KEY_DATA_LIST.data(), &keyDataList_r );
114 d.set( KEY_DATA.data(), keySigning_r );
115 d.set( KEY_CONTEXT.data(), keyContext_r );
116 return d;
117 }
118}
zypp::PublicKeyData
Class representing one GPG Public Keys data.
Definition PublicKey.h:201
zypp::PublicKey
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition PublicKey.h:375
zypp::callback::UserData::set
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
Definition UserData.h:119
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zyppng::TrustKeyRequest
Definition userrequest.h:71
zyppng::TrustKeyRequest::setChoice
void setChoice(const KeyTrust sel)
Definition userrequest.cc:40
zyppng::TrustKeyRequest::KeyTrust
KeyTrust
Definition userrequest.h:79
zyppng::TrustKeyRequest::label
const std::string label() const
Definition userrequest.cc:46
zyppng::TrustKeyRequest::_answer
KeyTrust _answer
Definition userrequest.h:111
zyppng::TrustKeyRequest::_label
std::string _label
Definition userrequest.h:110
zyppng::TrustKeyRequest::choice
KeyTrust choice() const
Definition userrequest.cc:43
zyppng::TrustKeyRequest::type
UserRequestType type() const override
Definition userrequest.cc:49
zyppng::UserRequest
Definition userrequest.h:49
std
Definition ansi.h:855
zyppng::AcceptFailedVerificationRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptFailedVerificationRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptFailedVerificationRequest::makeData
UserData makeData(const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:86
zyppng::AcceptFailedVerificationRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptFailedVerificationRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-failed-verification")
zyppng::AcceptKeyRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-key")
zyppng::AcceptKeyRequest::makeData
UserData makeData(const zypp::PublicKey &key, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:52
zyppng::AcceptKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptNoDigestRequest::makeData
UserData makeData(const zypp::Pathname &p)
Definition userrequest.cc:13
zyppng::AcceptNoDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-no-digest")
zyppng::AcceptNoDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptPackageKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-package-key")
zyppng::AcceptPackageKeyRequest::makeData
UserData makeData(const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r=zypp::KeyContext())
Definition userrequest.cc:95
zyppng::AcceptPackageKeyRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptPackageKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnknownDigestRequest::makeData
UserData makeData(const zypp::Pathname &p, const std::string &name)
Definition userrequest.cc:19
zyppng::AcceptUnknownDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-unknown-digest")
zyppng::AcceptUnknownDigestRequest::NAME
constexpr std::string_view NAME("name")
zyppng::AcceptUnknownDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnknownKeyRequest::makeData
UserData makeData(const std::string &file, const std::string &id, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:77
zyppng::AcceptUnknownKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnknownKeyRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnknownKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-unknown-key")
zyppng::AcceptUnknownKeyRequest::KEYID
constexpr std::string_view KEYID("keyid")
zyppng::AcceptUnsignedFileRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-unsigned-file")
zyppng::AcceptUnsignedFileRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnsignedFileRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnsignedFileRequest::makeData
UserData makeData(const std::string &file, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:69
zyppng::AcceptWrongDigestRequest::makeData
UserData makeData(const zypp::Pathname &p, const std::string &requested, const std::string &found)
Definition userrequest.cc:26
zyppng::AcceptWrongDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-unknown-digest")
zyppng::AcceptWrongDigestRequest::NAME_FOUND
constexpr std::string_view NAME_FOUND("found")
zyppng::AcceptWrongDigestRequest::NAME_REQUESTED
constexpr std::string_view NAME_REQUESTED("requested")
zyppng::AcceptWrongDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::KeyAutoImportInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/auto-import-key-info")
zyppng::KeyAutoImportInfoEvent::KEY_DATA_LIST
constexpr std::string_view KEY_DATA_LIST("key-data-list")
zyppng::KeyAutoImportInfoEvent::makeData
UserData makeData(const std::list< zypp::PublicKeyData > &keyDataList_r, const zypp::PublicKeyData &keySigning_r, const zypp::KeyContext &keyContext_r)
Definition userrequest.cc:110
zyppng::KeyAutoImportInfoEvent::KEY_DATA
constexpr std::string_view KEY_DATA("key-data")
zyppng::KeyAutoImportInfoEvent::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::NonImportedKeysInfoEvent::KEYS
constexpr std::string_view KEYS("keys")
zyppng::NonImportedKeysInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/keys-not-imported")
zyppng::NonImportedKeysInfoEvent::makeData
UserData makeData(const std::set< zypp::Edition > &keys_r)
Definition userrequest.cc:103
zyppng::VerifyInfoEvent::FILE
constexpr std::string_view FILE("file")
zyppng::VerifyInfoEvent::makeData
UserData makeData(const std::string &file_r, const zypp::PublicKeyData &keyData_r, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:60
zyppng::VerifyInfoEvent::KEY_DATA
constexpr std::string_view KEY_DATA("key-data")
zyppng::VerifyInfoEvent::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::VerifyInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/info-verify")
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::UserRequestType
UserRequestType
Definition userrequest.h:34
zyppng::UserRequestType::KeyTrust
@ KeyTrust
Definition userrequest.h:38
zyppng::UserData
zypp::callback::UserData UserData
Definition userrequest.h:18
zyppng::ZYPP_IMPL_PRIVATE_CONSTR_ARGS
ZYPP_IMPL_PRIVATE_CONSTR_ARGS(TrustKeyRequest, std::string label, KeyTrust trust, UserData userData)
Definition userrequest.cc:34
zypp::KeyContext
Definition KeyContext.h:9
userrequest.h