My Project
securitycontext.cpp
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2018 elementary, Inc
5  *
6  * Contact: Corentin Noël <corentin@elementary.io>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #include <QMetaType>
24 #include <QStringList>
25 
26 #include "debug.h"
27 #include "securitycontext.h"
28 #include "securitycontextpriv.h"
29 
30 namespace SignOn {
31 
33 {
34 }
35 
36 SecurityContext::SecurityContext(const QString &systemContext,
37  const QString &applicationContext):
38  m_systemContext(systemContext),
39  m_applicationContext(applicationContext)
40 {
41 }
42 
43 QDBusArgument &operator<<(QDBusArgument &argument,
44  const SecurityContext &securityContext)
45 {
46  argument.beginStructure();
47  argument << securityContext.systemContext()
48  << securityContext.applicationContext();
49  argument.endStructure();
50  return argument;
51 }
52 
53 const QDBusArgument &operator>>(const QDBusArgument &argument,
54  SecurityContext &securityContext)
55 {
56  QString systemContext;
57  QString applicationContext;
58 
59  argument.beginStructure();
60  argument >> systemContext >> applicationContext;
61  securityContext.setSystemContext(systemContext);
62  securityContext.setApplicationContext(applicationContext);
63  argument.endStructure();
64  return argument;
65 }
66 
67 void SecurityContext::setSystemContext(const QString &systemContext)
68 {
69  m_systemContext = systemContext;
70 }
71 
73 {
74  return m_systemContext;
75 }
76 
77 void SecurityContext::setApplicationContext(const QString &applicationContext)
78 {
79  m_applicationContext = applicationContext;
80 }
81 
83 {
84  return m_applicationContext;
85 }
86 
87 } // namespace SignOn
Contains access security context information.
QString systemContext() const
Gets the system context.
SecurityContext()
Creates a new SecurityContext object.
void setApplicationContext(const QString &applicationContext)
Sets the application context.
QString applicationContext() const
Gets the application context.
void setSystemContext(const QString &systemContext)
Sets the system context.