signon  8.42
accesscontrolmanagerhelper.h
Go to the documentation of this file.
1 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of signon
4  *
5  * Copyright (C) 2009-2010 Nokia Corporation.
6  * Copyright (C) 2011 Intel Corporation.
7  *
8  * Contact: Aurel Popirtac <ext-Aurel.Popirtac@nokia.com>
9  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
10  * Contact: Elena Reshetova <elena.reshetova@intel.com>
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * version 2.1 as published by the Free Software Foundation.
15  *
16  * This library is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26 
33 #ifndef ACCESSCONTROLMANAGERHELPER_H
34 #define ACCESSCONTROLMANAGERHELPER_H
35 
36 #include <QIODevice>
37 #include <QMap>
38 #include <QDBusConnection>
39 #include <QDBusContext>
40 #include <QDBusMessage>
41 
42 #include "signonauthsession.h"
43 #include "SignOn/abstract-access-control-manager.h"
44 
45 namespace SignonDaemonNS {
46 
53 {
54 public:
65  };
66 
67  AccessControlManagerHelper(SignOn::AbstractAccessControlManager *acManager);
69 
74  static pid_t pidOfPeer(const QDBusContext &peerContext);
75 
76  /* creating an instance of a class */
78 
85  bool isPeerAllowedToUseIdentity(const QDBusMessage &peerMessage,
86  const quint32 identityId);
87 
97  IdentityOwnership isPeerOwnerOfIdentity(const QDBusMessage &peerMessage,
98  const quint32 identityId);
99 
108  bool isPeerAllowedToUseAuthSession(const QDBusMessage &peerMessage,
109  const SignonAuthSession &authSession)
110  {
111  return isPeerAllowedToUseIdentity(peerMessage, authSession.id());
112  }
113 
122  bool isPeerAllowedToUseAuthSession(const QDBusMessage &peerMessage,
123  const quint32 ownerIdentityId)
124  {
125  return isPeerAllowedToUseIdentity(peerMessage, ownerIdentityId);
126  }
127 
132  bool isPeerKeychainWidget(const QDBusMessage &peerMessage);
133 
140  QString appIdOfPeer(const QDBusMessage &peerMessage);
141 
151  bool isPeerAllowedToAccess(const QDBusMessage &peerMessage,
152  const QString securityContext);
153 
163  bool peerHasOneOfAccesses(const QDBusMessage &peerMessage,
164  const QStringList secContexts);
165 
166 private:
167  SignOn::AbstractAccessControlManager *m_acManager;
168  static AccessControlManagerHelper* m_pInstance;
169 };
170 
171 } // namespace SignonDaemonNS
172 
173 #endif // ACCESSCONTROLMANAGER_H