Policy Cache

Policy Cache — Holds the actions defined on the system.

Synopsis

                    PolKitPolicyCache;
polkit_bool_t       (*PolKitPolicyCacheForeachFunc)     (PolKitPolicyCache *policy_cache,
                                                         PolKitPolicyFileEntry *entry,
                                                         void *user_data);
PolKitPolicyCache*  polkit_policy_cache_ref             (PolKitPolicyCache *policy_cache);
void                polkit_policy_cache_unref           (PolKitPolicyCache *policy_cache);
void                polkit_policy_cache_debug           (PolKitPolicyCache *policy_cache);
PolKitPolicyFileEntry* polkit_policy_cache_get_entry    (PolKitPolicyCache *policy_cache,
                                                         PolKitAction *action);
PolKitPolicyFileEntry* polkit_policy_cache_get_entry_by_id
                                                        (PolKitPolicyCache *policy_cache,
                                                         const char *action_id);
PolKitPolicyFileEntry* polkit_policy_cache_get_entry_by_annotation
                                                        (PolKitPolicyCache *policy_cache,
                                                         const char *annotation_key,
                                                         const char *annotation_value);
polkit_bool_t       polkit_policy_cache_foreach         (PolKitPolicyCache *policy_cache,
                                                         PolKitPolicyCacheForeachFunc callback,
                                                         void *user_data);

Description

This class is used to hold all policy objects (stemming from policy files) and provide look-up functions.

Details

PolKitPolicyCache

typedef struct _PolKitPolicyCache PolKitPolicyCache;

Instances of this class are used to hold all policy objects (stemming from policy files) and provide look-up functions.


PolKitPolicyCacheForeachFunc ()

polkit_bool_t       (*PolKitPolicyCacheForeachFunc)     (PolKitPolicyCache *policy_cache,
                                                         PolKitPolicyFileEntry *entry,
                                                         void *user_data);

Callback function for polkit_policy_cache_foreach().

policy_cache : the policy cache
entry : an entry in the cache - do not unref
user_data : user data passed to polkit_policy_cache_foreach()
Returns : TRUE to short-circuit; e.g. stop the iteration

polkit_policy_cache_ref ()

PolKitPolicyCache*  polkit_policy_cache_ref             (PolKitPolicyCache *policy_cache);

Increase reference count.

policy_cache : the policy cache object
Returns : the object

polkit_policy_cache_unref ()

void                polkit_policy_cache_unref           (PolKitPolicyCache *policy_cache);

Decreases the reference count of the object. If it becomes zero, the object is freed. Before freeing, reference counts on embedded objects are decresed by one.

policy_cache : the policy cache object

polkit_policy_cache_debug ()

void                polkit_policy_cache_debug           (PolKitPolicyCache *policy_cache);

Print debug information about object

policy_cache : the cache

polkit_policy_cache_get_entry ()

PolKitPolicyFileEntry* polkit_policy_cache_get_entry    (PolKitPolicyCache *policy_cache,
                                                         PolKitAction *action);

Given a action, find the object describing the definition of the policy; e.g. data stemming from files in /usr/share/PolicyKit/policy.

policy_cache : the cache
action : the action
Returns : A PolKitPolicyFileEntry entry on sucess; otherwise NULL if the action wasn't identified. Caller shall not unref this object.

polkit_policy_cache_get_entry_by_id ()

PolKitPolicyFileEntry* polkit_policy_cache_get_entry_by_id
                                                        (PolKitPolicyCache *policy_cache,
                                                         const char *action_id);

Given a action identifier, find the object describing the definition of the policy; e.g. data stemming from files in /usr/share/PolicyKit/policy.

policy_cache : the cache
action_id : the action identifier
Returns : A PolKitPolicyFileEntry entry on sucess; otherwise NULL if the action wasn't identified. Caller shall not unref this object.

polkit_policy_cache_get_entry_by_annotation ()

PolKitPolicyFileEntry* polkit_policy_cache_get_entry_by_annotation
                                                        (PolKitPolicyCache *policy_cache,
                                                         const char *annotation_key,
                                                         const char *annotation_value);

Find the first policy file entry where a given annotation matches a given value. Note that there is nothing preventing the existence of multiple policy file entries matching this criteria; it would however be a packaging bug if this situation occured.

policy_cache : the policy cache
annotation_key : the key to check for
annotation_value : the value to check for
Returns : The first PolKitPolicyFileEntry matching the search criteria. The caller shall not unref this object. Returns NULL if there are no policy file entries matching the search criteria.

Since 0.7


polkit_policy_cache_foreach ()

polkit_bool_t       polkit_policy_cache_foreach         (PolKitPolicyCache *policy_cache,
                                                         PolKitPolicyCacheForeachFunc callback,
                                                         void *user_data);

Visit all entries in the policy cache.

policy_cache : the policy cache
callback : callback function
user_data : user data to pass to callback function
Returns : TRUE only if iteration was short-circuited