klass->enumerate_groups (authority, pending_call);
}
+
+void
+polkit_backend_authority_check_claim (PolkitBackendAuthority *authority,
+ PolkitAuthorizationClaim *claim,
+ PolkitBackendPendingCall *pending_call)
+{
+ PolkitBackendAuthorityClass *klass;
+
+ klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
+
+ klass->check_claim (authority, claim, pending_call);
+}
void (*enumerate_groups) (PolkitBackendAuthority *authority,
PolkitBackendPendingCall *pending_call);
+ void (*check_claim) (PolkitBackendAuthority *authority,
+ PolkitAuthorizationClaim *claim,
+ PolkitBackendPendingCall *pending_call);
+
/*< private >*/
/* Padding for future expansion */
void (*_polkit_reserved1) (void);
GType polkit_backend_authority_get_type (void) G_GNUC_CONST;
-void polkit_backend_authority_enumerate_actions (PolkitBackendAuthority *authority,
- const gchar *locale,
- PolkitBackendPendingCall *pending_call);
+/* --- */
+
+void polkit_backend_authority_enumerate_actions (PolkitBackendAuthority *authority,
+ const gchar *locale,
+ PolkitBackendPendingCall *pending_call);
+
+void polkit_backend_authority_enumerate_users (PolkitBackendAuthority *authority,
+ PolkitBackendPendingCall *pending_call);
+
+void polkit_backend_authority_enumerate_groups (PolkitBackendAuthority *authority,
+ PolkitBackendPendingCall *pending_call);
+
+void polkit_backend_authority_check_claim (PolkitBackendAuthority *authority,
+ PolkitAuthorizationClaim *claim,
+ PolkitBackendPendingCall *pending_call);
+
+/* --- */
-void polkit_backend_authority_enumerate_users (PolkitBackendAuthority *authority,
- PolkitBackendPendingCall *pending_call);
+void polkit_backend_authority_enumerate_actions_finish (PolkitBackendPendingCall *pending_call,
+ GList *actions);
-void polkit_backend_authority_enumerate_groups (PolkitBackendAuthority *authority,
- PolkitBackendPendingCall *pending_call);
+void polkit_backend_authority_enumerate_users_finish (PolkitBackendPendingCall *pending_call,
+ GList *users);
-void polkit_backend_authority_enumerate_actions_finish (PolkitBackendPendingCall *pending_call,
- GList *actions);
+void polkit_backend_authority_enumerate_groups_finish (PolkitBackendPendingCall *pending_call,
+ GList *groups);
-void polkit_backend_authority_enumerate_users_finish (PolkitBackendPendingCall *pending_call,
- GList *users);
+void polkit_backend_authority_check_claim_finish (PolkitBackendPendingCall *pending_call,
+ PolkitAuthorizationResult result);
-void polkit_backend_authority_enumerate_groups_finish (PolkitBackendPendingCall *pending_call,
- GList *groups);
G_END_DECLS
static void polkit_backend_local_authority_enumerate_groups (PolkitBackendAuthority *authority,
PolkitBackendPendingCall *pending_call);
+static void polkit_backend_local_authority_check_claim (PolkitBackendAuthority *authority,
+ PolkitAuthorizationClaim *claim,
+ PolkitBackendPendingCall *pending_call);
+
G_DEFINE_TYPE (PolkitBackendLocalAuthority, polkit_backend_local_authority, POLKIT_BACKEND_TYPE_AUTHORITY);
#define POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), POLKIT_BACKEND_TYPE_LOCAL_AUTHORITY, PolkitBackendLocalAuthorityPrivate))
authority_class->enumerate_actions = polkit_backend_local_authority_enumerate_actions;
authority_class->enumerate_users = polkit_backend_local_authority_enumerate_users;
authority_class->enumerate_groups = polkit_backend_local_authority_enumerate_groups;
+ authority_class->check_claim = polkit_backend_local_authority_check_claim;
g_type_class_add_private (klass, sizeof (PolkitBackendLocalAuthorityPrivate));
}
out:
;
}
+
+static void
+polkit_backend_local_authority_check_claim (PolkitBackendAuthority *authority,
+ PolkitAuthorizationClaim *claim,
+ PolkitBackendPendingCall *pending_call)
+{
+ polkit_backend_pending_call_return_error (pending_call,
+ POLKIT_ERROR,
+ POLKIT_ERROR_NOT_SUPPORTED,
+ "Not implemented");
+}
+
g_list_foreach (users, (GFunc) g_object_unref, NULL);
g_list_free (users);
+
+ g_object_unref (pending_call);
}
static void
g_list_foreach (groups, (GFunc) g_object_unref, NULL);
g_list_free (groups);
+
+ g_object_unref (pending_call);
+}
+
+static void
+authority_handle_check_claim (_PolkitAuthority *instance,
+ _PolkitAuthorizationClaim *real_claim,
+ EggDBusMethodInvocation *method_invocation)
+{
+ PolkitBackendServer *server = POLKIT_BACKEND_SERVER (instance);
+ PolkitBackendPendingCall *pending_call;
+ PolkitAuthorizationClaim *claim;
+
+ pending_call = _polkit_backend_pending_call_new (method_invocation, server);
+
+ claim = polkit_authorization_claim_new_for_real (real_claim);
+
+ g_object_set_data_full (G_OBJECT (pending_call), "claim", claim, (GDestroyNotify) g_object_unref);
+
+ polkit_backend_authority_check_claim (server->authority, claim, pending_call);
+}
+
+void
+polkit_backend_authority_check_claim_finish (PolkitBackendPendingCall *pending_call,
+ PolkitAuthorizationResult result)
+{
+ EggDBusHashMap *attributes;
+
+ attributes = egg_dbus_hash_map_new (G_TYPE_STRING, g_free, G_TYPE_STRING, g_free);
+
+ _polkit_authority_handle_check_claim_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
+ result,
+ attributes);
+
+ g_object_unref (attributes);
+
+ g_object_unref (pending_call);
}
static void
authority_iface->handle_enumerate_actions = authority_handle_enumerate_actions;
authority_iface->handle_enumerate_users = authority_handle_enumerate_users;
authority_iface->handle_enumerate_groups = authority_handle_enumerate_groups;
+ authority_iface->handle_check_claim = authority_handle_check_claim;
}