1 /*
2  * Copyright (C) 2008 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Author: David Zeuthen <davidz@redhat.com>
20  */
21 
22 #if !defined (_POLKIT_BACKEND_COMPILATION) && !defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H)
23 #error "Only <polkitbackend/polkitbackend.h> can be included directly, this file may disappear or change contents."
24 #endif
25 
26 #ifndef __POLKIT_BACKEND_INTERACTIVE_AUTHORITY_H
27 #define __POLKIT_BACKEND_INTERACTIVE_AUTHORITY_H
28 
29 #include <glib-object.h>
30 #include <polkitbackend/polkitbackendtypes.h>
31 #include <polkitbackend/polkitbackendauthority.h>
32 
33 G_BEGIN_DECLS
34 
35 #define POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY         (polkit_backend_interactive_authority_get_type ())
36 #define POLKIT_BACKEND_INTERACTIVE_AUTHORITY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY, PolkitBackendInteractiveAuthority))
37 #define POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY, PolkitBackendInteractiveAuthorityClass))
38 #define POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY,PolkitBackendInteractiveAuthorityClass))
39 #define POLKIT_BACKEND_IS_INTERACTIVE_AUTHORITY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY))
40 #define POLKIT_BACKEND_IS_INTERACTIVE_AUTHORITY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY))
41 
42 typedef struct _PolkitBackendInteractiveAuthorityClass    PolkitBackendInteractiveAuthorityClass;
43 
44 /**
45  * PolkitBackendInteractiveAuthority:
46  *
47  * The #PolkitBackendInteractiveAuthority struct should not be accessed directly.
48  */
49 struct _PolkitBackendInteractiveAuthority
50 {
51   /*< private >*/
52   PolkitBackendAuthority parent_instance;
53 };
54 
55 /**
56  * PolkitBackendInteractiveAuthorityClass:
57  * @parent_class: The parent class.
58  * @get_admin_identities: Returns list of identities for administrator authentication or %NULL to use the default
59  *   implementation. See polkit_backend_interactive_authority_get_admin_identities() for details.
60  * @check_authorization_sync: Checks for an authorization or %NULL to use the default implementation.
61  *  See polkit_backend_interactive_authority_check_authorization_sync() for details.
62  *
63  * Class structure for #PolkitBackendInteractiveAuthority.
64  */
65 struct _PolkitBackendInteractiveAuthorityClass
66 {
67   /*< public >*/
68   PolkitBackendAuthorityClass parent_class;
69 
70   /* VTable */
71   GList *                     (*get_admin_identities)          (PolkitBackendInteractiveAuthority *authority,
72                                                                 PolkitSubject                     *caller,
73                                                                 PolkitSubject                     *subject,
74                                                                 PolkitIdentity                    *user_for_subject,
75                                                                 gboolean                           subject_is_local,
76                                                                 gboolean                           subject_is_active,
77                                                                 const gchar                       *action_id,
78                                                                 PolkitDetails                     *details);
79 
80   PolkitImplicitAuthorization (*check_authorization_sync) (PolkitBackendInteractiveAuthority *authority,
81                                                            PolkitSubject                     *caller,
82                                                            PolkitSubject                     *subject,
83                                                            PolkitIdentity                    *user_for_subject,
84                                                            gboolean                           subject_is_local,
85                                                            gboolean                           subject_is_active,
86                                                            const gchar                       *action_id,
87                                                            PolkitDetails                     *details,
88                                                            PolkitImplicitAuthorization        implicit);
89 
90   /*< private >*/
91   /* Padding for future expansion */
92   void (*_polkit_reserved1) (void);
93   void (*_polkit_reserved2) (void);
94   void (*_polkit_reserved3) (void);
95   void (*_polkit_reserved4) (void);
96   void (*_polkit_reserved5) (void);
97   void (*_polkit_reserved6) (void);
98   void (*_polkit_reserved7) (void);
99   void (*_polkit_reserved8) (void);
100   void (*_polkit_reserved9) (void);
101   void (*_polkit_reserved10) (void);
102   void (*_polkit_reserved11) (void);
103   void (*_polkit_reserved12) (void);
104   void (*_polkit_reserved13) (void);
105   void (*_polkit_reserved14) (void);
106   void (*_polkit_reserved15) (void);
107   void (*_polkit_reserved16) (void);
108   void (*_polkit_reserved17) (void);
109   void (*_polkit_reserved18) (void);
110   void (*_polkit_reserved19) (void);
111   void (*_polkit_reserved20) (void);
112   void (*_polkit_reserved21) (void);
113   void (*_polkit_reserved22) (void);
114   void (*_polkit_reserved23) (void);
115   void (*_polkit_reserved24) (void);
116   void (*_polkit_reserved25) (void);
117   void (*_polkit_reserved26) (void);
118   void (*_polkit_reserved27) (void);
119   void (*_polkit_reserved28) (void);
120   void (*_polkit_reserved29) (void);
121   void (*_polkit_reserved30) (void);
122   void (*_polkit_reserved31) (void);
123   void (*_polkit_reserved32) (void);
124 };
125 
126 GType   polkit_backend_interactive_authority_get_type            (void) G_GNUC_CONST;
127 GList  *polkit_backend_interactive_authority_get_admin_identities (PolkitBackendInteractiveAuthority *authority,
128                                                                    PolkitSubject                     *caller,
129                                                                    PolkitSubject                     *subject,
130                                                                    PolkitIdentity                    *user_for_subject,
131                                                                    gboolean                           subject_is_local,
132                                                                    gboolean                           subject_is_active,
133                                                                    const gchar                       *action_id,
134                                                                    PolkitDetails                     *details);
135 
136 PolkitImplicitAuthorization polkit_backend_interactive_authority_check_authorization_sync (
137                                                           PolkitBackendInteractiveAuthority *authority,
138                                                           PolkitSubject                     *caller,
139                                                           PolkitSubject                     *subject,
140                                                           PolkitIdentity                    *user_for_subject,
141                                                           gboolean                           subject_is_local,
142                                                           gboolean                           subject_is_active,
143                                                           const gchar                       *action_id,
144                                                           PolkitDetails                     *details,
145                                                           PolkitImplicitAuthorization        implicit);
146 
147 G_END_DECLS
148 
149 #endif /* __POLKIT_BACKEND_INTERACTIVE_AUTHORITY_H */
150 
151