Core API Reference - Policy File Entry
Desktop Apps Training - Policy Kit

Policy File Entry

Policy File Entry — Represents a declared action in a policy file.

 

Synopsis



PolKitPolicyFileEntry;
polkit_bool_t (*PolKitPolicyFileEntryAnnotationsForeachFunc)
(PolKitPolicyFileEntry *policy_file_entry,
const char *key,
const char *value,
void *user_data);
PolKitPolicyFileEntry* polkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry);
void polkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry);
void polkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry);
PolKitPolicyDefault* polkit_policy_file_entry_get_default
(PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_action_description
(PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_action_message
(PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_action_vendor
(PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_action_vendor_url
(PolKitPolicyFileEntry *policy_file_entry);
const char* polkit_policy_file_entry_get_action_icon_name
(PolKitPolicyFileEntry *policy_file_entry);
polkit_bool_t polkit_policy_file_entry_annotations_foreach
(PolKitPolicyFileEntry *policy_file_entry,
PolKitPolicyFileEntryAnnotationsForeachFunc cb,
void *user_data);
const char* polkit_policy_file_entry_get_annotation
(PolKitPolicyFileEntry *policy_file_entry,
const char *key);
PolKitPolicyDefault* polkit_policy_file_entry_get_default_factory
(PolKitPolicyFileEntry *policy_file_entry);
polkit_bool_t polkit_policy_file_entry_set_default
(PolKitPolicyFileEntry *policy_file_entry,
PolKitPolicyDefault *defaults,
PolKitError **error);

Description

This class is used to represent a entries in policy files.

 

Details

PolKitPolicyFileEntry

typedef struct _PolKitPolicyFileEntry PolKitPolicyFileEntry;

Objects of this class are used to record information about a policy.

 


PolKitPolicyFileEntryAnnotationsForeachFunc ()

polkit_bool_t       (*PolKitPolicyFileEntryAnnotationsForeachFunc)
(PolKitPolicyFileEntry *policy_file_entry,
const char *key,
const char *value,
void *user_data);

Callback function for polkit_policy_file_entry_annotations_foreach().

 

policy_file_entry :

the policy file entry

key :

key of the annotation

value :

corrosponding value of the annotation

user_data :

user data passed to polkit_policy_file_entry_annotations_foreach()

Returns :

Pass TRUE to short-circuit, e.g. stop the iteration

polkit_policy_file_entry_ref ()

PolKitPolicyFileEntry* polkit_policy_file_entry_ref     (PolKitPolicyFileEntry *policy_file_entry);

Increase reference count.

 

policy_file_entry :

the policy file object

Returns :

the object

polkit_policy_file_entry_unref ()

void                polkit_policy_file_entry_unref      (PolKitPolicyFileEntry *policy_file_entry);

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_file_entry :

the policy file object

polkit_policy_file_entry_debug ()

void                polkit_policy_file_entry_debug      (PolKitPolicyFileEntry *policy_file_entry);

Print debug information about object

 

policy_file_entry :

the entry

polkit_policy_file_entry_get_id ()

const char*         polkit_policy_file_entry_get_id     (PolKitPolicyFileEntry *policy_file_entry);

Get the action identifier.

 

policy_file_entry :

the file entry

Returns :

A string - caller shall not free this string.

polkit_policy_file_entry_get_default ()

PolKitPolicyDefault* polkit_policy_file_entry_get_default
(PolKitPolicyFileEntry *policy_file_entry);

Get the the default policy for this policy.

 

policy_file_entry :

the file entry

Returns :

A PolKitPolicyDefault object - caller shall not unref or modify this object.

polkit_policy_file_entry_get_action_description ()

const char*         polkit_policy_file_entry_get_action_description
(PolKitPolicyFileEntry *policy_file_entry);

Get the description of the action that this policy entry describes. This is intended to be used in policy editors, for example "Mount internal volumes". Contrast with polkit_policy_file_entry_get_action_message(). The textual string will be returned in the current locale.

Note, if polkit_context_set_load_descriptions() on the PolKitContext object used to get this object wasn't called, this method will return NULL.

 

policy_file_entry :

the object

Returns :

string or NULL if descriptions are not loaded - caller shall not free this string

polkit_policy_file_entry_get_action_message ()

const char*         polkit_policy_file_entry_get_action_message
(PolKitPolicyFileEntry *policy_file_entry);

Get the message describing the action that this policy entry describes. This is to be used in dialogs, for example "System Policy prevents mounting this volume". Contrast with polkit_policy_file_entry_get_action_description(). The textual string will be returned in the current locale.

Note, if polkit_context_set_load_descriptions() on the PolKitContext object used to get this object wasn't called, this method will return NULL.

 

policy_file_entry :

the object

Returns :

string or NULL if descriptions are not loaded - caller shall not free this string

polkit_policy_file_entry_get_action_vendor ()

const char*         polkit_policy_file_entry_get_action_vendor
(PolKitPolicyFileEntry *policy_file_entry);

Get the name of the vendor of this action.

Note, if polkit_context_set_load_descriptions() on the PolKitContext object used to get this object wasn't called, this method will return NULL.

 

policy_file_entry :

the object

Returns :

string or NULL if descriptions are not loaded or vendor tag isn't set - caller shall not free this string

Since 0.7


polkit_policy_file_entry_get_action_vendor_url ()

const char*         polkit_policy_file_entry_get_action_vendor_url
(PolKitPolicyFileEntry *policy_file_entry);

Get the URL of the vendor of this action.

Note, if polkit_context_set_load_descriptions() on the PolKitContext object used to get this object wasn't called, this method will return NULL.

 

policy_file_entry :

the object

Returns :

string or NULL if descriptions are not loaded or vendor url isn't set - caller shall not free this string

Since 0.7


polkit_policy_file_entry_get_action_icon_name ()

const char*         polkit_policy_file_entry_get_action_icon_name
(PolKitPolicyFileEntry *policy_file_entry);

Get the name of the icon that represents the action. This name conforms to the freedesktop.org icon naming specification.

Note, if polkit_context_set_load_descriptions() on the PolKitContext object used to get this object wasn't called, this method will return NULL.

 

policy_file_entry :

the object

Returns :

string or NULL if descriptions are not loaded or icon tag isn't set - caller shall not free this string

Since 0.7


polkit_policy_file_entry_annotations_foreach ()

polkit_bool_t       polkit_policy_file_entry_annotations_foreach
(PolKitPolicyFileEntry *policy_file_entry,
PolKitPolicyFileEntryAnnotationsForeachFunc cb,
void *user_data);

Iterate over all annotations on the policy file entry.

 

policy_file_entry :

the policy file entry

cb :

callback function

user_data :

user data to pass to the callback function

Returns :

TRUE only if the iteration was short-circuited

polkit_policy_file_entry_get_annotation ()

const char*         polkit_policy_file_entry_get_annotation
(PolKitPolicyFileEntry *policy_file_entry,
const char *key);

Look of the value of a given annotation.

 

policy_file_entry :

the policy file entry

key :

the key of the annotation

Returns :

The value of the annotation or NULL if not found.

polkit_policy_file_entry_get_default_factory ()

PolKitPolicyDefault* polkit_policy_file_entry_get_default_factory
(PolKitPolicyFileEntry *policy_file_entry);

Get the factory defaults for the entry. This may be different that what polkit_policy_file_entry_get_default() returns if the function polkit_policy_file_entry_set_default() have been used to change the defaults.

 

policy_file_entry :

the file entry

Returns :

A PolKitPolicyDefault object - caller shall not unref or modify this object.

Since 0.7


polkit_policy_file_entry_set_default ()

polkit_bool_t       polkit_policy_file_entry_set_default
(PolKitPolicyFileEntry *policy_file_entry,
PolKitPolicyDefault *defaults,
PolKitError **error);

Set new defaults for a given policy file entry; subsequent calls to polkit_policy_file_get_default() will return these values. Note that the old defaults are not modified; they are still available via polkit_policy_file_entry_get_default_factory().

This operation requires the org.freedesktop.policykit.modify-defaults authorization and will fail if the caller lacks it.

 

policy_file_entry :

the file entry

defaults :

the new defaults to set

error :

return location for error or NULL

Returns :

TRUE if the given defaults was set; FALSE if error is set.

Since 0.7